在Ubuntu上编译android

合集下载

Vlc for android 源码在Ubuntu下编译

Vlc for android 源码在Ubuntu下编译

Vlc for android 源码在Ubuntu下编译1.Android是在Java基础上开发的,所以先配置好Java代码能够运行的环境,再配置好Android代码运行的环境。

(1)下载好Java jdk,记得是Linux版本的,而且区分32位和64位,然后解压缩安装。

(2)安装完成后配置Java环境变量,在终端输入命令sudo gedit /etc/profile打开profile文件加上几行,注意右边是自己的jdk 存放路径还有解压之后的jre路径,也可以写绝对路径(图2)。

对于文件的绝对路径有疑惑的一定右键查看properties!大部分问题都是环境变量配错了!(3)最后成功的标志是在Ubuntu的终端输入java –version出来相应的版本信息(图3)。

这一步网上有很多帖子,不再赘述。

(4)配好Java运行环境之后就是配置Android了,下载好Android 的sdk和ndk解压缩之后修改环境变量即可。

注意:一般技术贴强调了ANDROID_SDK(sdk存放的绝对路径),ANDROID_NDK(ndk存放的绝对路径)还有PATH(sdk下的platform-tools和tools的绝对路径)这三个环境变量,但是我按照他们的方法却一直出错(这个帖子是良心好贴啊,有图有真相/s/blog_858820890101ekpc.html),后来在PATH之后把sdk,ndk的路径又附上去了才出来了正确结果,就是帖子里讲到的emulator –version和ndk-build检验成功!2.到这里我们走了万里长征的一小小步!可以开始来编译我们的源码了。

有一些帖子还说了编译源码前要安装的很多其他的东西,apache-ant (or ant), autoconf, automake, autopoint, cmake, gawk (or nawk), gcc, g++, libtool, git,m4, patch, pkg-config, ragel, /deng0zhaotai/article/details/37901557但是!不安装也可以大胆的去编译源码了,因为在编译过程中他会一步一步告诉你缺什么,缺什么就补上什么就好了。

ubuntu安装及android源码编译环境搭建

ubuntu安装及android源码编译环境搭建

ubuntu安装及android源码编译环境搭建为了能够编译和运行 Android 源码,我们需要在 Ubuntu 系统中搭建相应的开发环境。

下面是 Ubuntu 安装及 Android 源码编译环境搭建的详细步骤:一、Ubuntu 系统的安装2.将ISO文件写入USB或DVD中,制作启动盘。

3.在计算机上将系统引导到USB活动盘或DVD上,并启动系统。

4. 在启动菜单中选择安装 Ubuntu,按照提示完成安装过程。

二、系统更新和软件安装1.安装后,运行系统更新以获取最新的软件包和安全修复程序。

可以在终端中运行以下命令:```sudo apt updatesudo apt upgrade```2.安装开发工具和编译器。

可以在终端中运行以下命令:```sudo apt install build-essentialsudo apt install openjdk-8-jdksudo apt install pythonsudo apt install gitsudo apt install curlsudo apt install gnupg```1. 配置 Git 个人信息,可以在终端中运行以下命令:```git config --global "Your Name"``````chmod a+x ~/bin/repo```3. 配置 PATH 环境变量,这样在终端中就可以使用 Repo 了。

打开`~/.bashrc` 文件,并在末尾添加以下内容:```export PATH=~/bin:$PATH```4.执行以下命令使配置生效:```source ~/.bashrc```1. 创建一个空文件夹作为 Android 源码存放的目录,并在终端中进入该目录。

```repo init -u <URL> -b <branch>````````````repo sync```5.开始编译。

在Ubuntu上下载、编译和安装Android最新源代码

在Ubuntu上下载、编译和安装Android最新源代码

在Ubuntu上下载、编译和安装Android最新源代码在Ubuntu上下载、编译和安装Android最新源代码官⽹内容:Initializing a Build EnvironmentThe "Getting Started" section describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine. To build the Android source files, you will need to use Linux or Mac OS. Building undernot currently supported.Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.For an overview of the entire code-review and code-update process, see Life of a Patch.Setting up a Linux build environmentThe Android build is routinely tested in house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are welcome.Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.In general you will need:Python 2.4 -- 2.7, which you can download from .JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from .Git 1.7 or newer. You can find it at .Detailed instructions for Ubuntu 10.04+ follow.Installing the JDKThe Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.Java 6: for Gingerbread and newer$ sudo add-apt-repository "deb / lucid partner"$ sudo apt-get update$ sudo apt-get install sun-java6-jdkJava 5: for Froyo and older$ sudo add-apt-repository "deb /ubuntu hardy main multiverse"$ sudo add-apt-repository "deb /ubuntu hardy-updates main multiverse"$ sudo apt-get update$ sudo apt-get install sun-java5-jdkInstalling required packages64-bit (recommended)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxm On newer versions of Ubuntu such as 11.10 you may need to do the following:$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so32-bit (experimental)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown libxml2-utilsConfiguring USB AccessUnder GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it.must be replaced by the actual username of the user who is authorized to access the phones over USB.# adb protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"# fastboot protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"# adb protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"# fastboot protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"# adb protocol on maguro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"# fastboot protocol on maguro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.This is known to work on both Ubuntu Hardy Heron (8.04.x LTS) and Lucid Lynx (10.04.x LTS). Other versions of Ubuntu or other variants of GNU/linux might require different configurations.Setting up a Mac OS X build environmentTo build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.6 (Snow Leopard).Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+. HFS+ is required to successfully OS applications such as the Android Emulator for OS X.Creating a case sensitive disk imageIf you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead. To create the image, launch Disk Utility and select "New Image". A size of 25GB is the minimum to complete the build, larger numbers are more future-Using sparse images saves space while allowing to grow later as the need arises. Be sure to select "case sensitive, journaled" as the volume format.You can also create it from a shell with the following command:# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmgThis will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following toyour ~/.bash_profile to mount the image when you execute "mountAndroid":# mount the android file imagefunction mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.Installing required packagesInstall XCode from the Apple developer site. We recommend version 3.1.4 or newer, i.e. gcc 4.2. Version 4.x could cause difficulties. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download.Install MacPorts from .Note: Make sure that /opt/local/bin appears in your path BEFORE /usr/bin. If not, addexport PATH=/opt/local/bin:$PATHto your ~/.bash_profile.Get make, git, and GPG packages from MacPorts:$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupgIf using Mac OS 10.4, also install bison:$ POSIXLY_CORRECT=1 sudo port install bisonReverting from make 3.82There is a bug in gmake 3.82 that prevents android from building. You can install version 3.81 using MacPorts by taking the following steps:Edit /opt/local/etc/macports/sources.conf and add a line that saysfile:///Users/Shared/dportsabove the rsync line. Then create this directory:$ mkdir /Users/Shared/dportsIn the new dports directory, run$ svn co --revision 50980 /repository/macports/trunk/dports/devel/gmake/ devel/gmake/Create a port index for your new local repository:$ portindex /Users/Shared/dportsFinally, install the old version of gmake with$*************************Setting a file descriptor limitOn MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.To increase the cap, add the following lines to your ~/.bash_profile:# set the number of open files to be 1024ulimit -S -n 1024Downloading the Source TreeInstalling RepoRepo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Version Control.To install, initialize, and configure Repo, follow these steps:Make sure you have a bin/ directory in your home directory, and that it is included in your path:$ mkdir ~/bin$ PATH=~/bin:$PATHDownload the Repo script and ensure it is executable:$ curl https:///dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repoThe SHA-1 checksum for repo is e1fd3bef059d152edf4d0522590725d317bc637fInitializing a Repo clientAfter installing Repo, set up your client to access the android source repository:Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:$ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORYRun repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.$ repo init -u https:///platform/manifestTo check out a branch other than "master", specify it with -b:$ repo init -u https:///platform/manifest -b android-4.0.1_r1When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive mes The name that you provide here will show up in attributions for your code submissions.A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.Getting the filesTo pull down files to your working directory from the repositories as specified in the default manifest, run$ repo syncThe Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more about repo sync and other Repo commands, see Version Control.Verifying Git TagsLoad the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.$ gpg --importCopy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.-----BEGIN PGP PUBLIC KEY BLOCK-----Version: GnuPG v1.4.2.2 (GNU/Linux)mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSVlFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw78tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMDu4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0ZwNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5kcm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAlQN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806UphisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbkC2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMXLWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/MpK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7sKZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phbN8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjAvUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwoG1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQhN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0lEXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM==Wi5D-----END PGP PUBLIC KEY BLOCK-----After importing the keys, you can verify any tag with$ git tag -v TAG_NAMEBuilding the SystemThe basic sequence of build commands is as follows:InitializeInitialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.$ source build/envsetup.shor$ . build/envsetup.shChoose a TargetChoose which target to build with lunch. The exact configuration can be passed as an argument, e.g.$ lunch full-engThe example above refers to a complete build for the emulator, with all debugging enabled.If run with no arguments lunch will prompt you to choose a target from the menu.All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to the particular feature combination:Build name Device Notesfull emulator fully configured with all languages, apps, input methodsfull_maguro maguro full build running on Galaxy Nexus GSM/HSPA+ ("maguro")full_panda panda full build running on PandaBoard ("panda")and the BUILDTYPE is one of the following:Buildtype Useuser limited access; suited for productionuserdebug like "user" but with root access and debuggability; preferred for debuggingeng development configuration with additional debugging toolsFor more information about building for and running on actual hardware, see Building for devicesBuild the CodeBuild everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 mac CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.$ make -j4Run It!You can either run your build on an emulator or flash it on a device. Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for.Flash a DeviceTo flash a device, you will need to use fastboot, which should be included in your path after a successful build. Place the device in fastboot mode either manually by holding the appropriate key combination at boot, or from the shell with$ adb reboot bootloaderOnce the device is in fastboot mode, run$ fastboot flashall -wThe -w option wipes the /data partition on the device; this is useful for your first time flashing a particular device, but is otherwise unnecessary.For more information about building for and running on actual hardware, see Building for devicesEmulate an Android DeviceThe emulator is added to your path automatically by the build process. To run the emulator, type$ emulatorUsing ccacheccache is a compiler cache for C and C++ that can help make builds faster. In the root of the source tree, do the following:$ export USE_CCACHE=1$ export CCACHE_DIR=/<path_of_your_choice>/.ccache$ prebuilt/linux-x86/ccache/ccache -M 20GYou can watch ccache being used by doing the following:$ watch -n1 -d prebuilt/linux-x86/ccache/ccache -sOn OSX, you should replace linux-x86 with darwin-x86.Troubleshooting Common Build ErrorsWrong Java VersionIf you are attempting to build froyo or earlier with Java 1.6, or gingerbread or later with Java 1.5, make will abort with a message such as************************************************************You are attempting to build with the incorrect versionof java.Your version is: WRONG_VERSION.The correct version is: RIGHT_VERSION.Please follow the machine setup instructions at/download************************************************************This may be caused byfailing to install the correct JDK as specified on the Initializing page. Building Android requires Sun JDK 5 or 6 depending on which release you are building.another JDK that you previously installed appearing in your path. You can remove the offending JDK from your path with:$ export PATH=${PATH/\/path\/to\/jdk\/dir:/}Python Version 3Repo is built on particular functionality from Python 2.x and is unfortunately incompatible with Python 3. In order to use repo, please install Python 2.x:$ apt-get install pythonGmake Version 3.82There is a bug in make version 3.82 on Mac OS that prevents building Android.TODO: what the error looks like with GNU make 3.82 on older builds that don't explicitly detect it.Follow the instructions on the Initializing page for reverting GNU make from 3.82 to 3.81.Case Insensitive FilesystemIf you are building on an HFS filesystem on Mac OS X, you may encounter an error such as************************************************************You are building on a case-insensitive filesystem.Please move your source tree to a case-sensitive filesystem.************************************************************Please follow the instructions on the Initializing page for creating a case-sensitive disk image.No USB PermissionOn most Linux systems, unprivileged users cannot access USB ports by default. If you see a permission denied error, follow the instructions on the Initializing page for configuring USB access.If adb was already running and cannot connect to the device after getting those rules set up, it can be killed with adb kill-server. That will cause adb to restart with the new configuration.Building for devicesThis page complements the main page about Building with information that is specific to individual devices.The only supported phone with the current release is the GSM/HSPA+ Galaxy Nexus, a.k.a. "maguro". GSM/HSPA+ Galaxy Nexus is currently the recommended device to use with the Android Open-Source Project.In addition, PandaBoard a.k.a. "panda" is supported in the master branch only, but is currently considered experimental. The specific details to use a PandaBoard with the Android Open-Source Project are in the file device/ti/panda/README in the source tree. Nexus S, a.k.a. "crespo", and Nexus S 4G, a.k.a. "crespo4g", are supported with gingerbread, but can't currently be used with newer versions of the Android Open-Source Project.Nexus One a.k.a. "passion" is obsolete, was experimental in gingerbread and unsupported, and can't be used with newer versions of the Android Open-Source Project.Android Developer Phones (ADP1 and ADP2, a.k.a. "dream" and "sapphire") are obsolete, were experimental and unsupported in froyo, and can't be used with newer versions of the Android Open-Source Project.Building fastboot and adbIf you don't already have those tools, fastboot and adb can be built with the regular build system. Follow the instructions on the page about building, and replace the main make command with$ make fastboot adbBooting into fastboot modeDuring a cold boot, the following key combinations can be used to boot into fastboot mode, which is a mode in the bootloader that can be used to flash the devices:Device Keysmaguro Press and hold both Volume Up and Volume Down, then press and hold Powercrespo Press and hold Volume Up, then press and hold Powercrespo4g Press and hold Volume Up, then press and hold Powerpassion Press and hold the trackball, then press Powersapphire Press and hold Back, then press Powerdream Press and hold Back, then press PowerAlso, on devices running froyo or later where adb is enabled, the command adb reboot bootloader can be used to reboot from Android directly into the bootloader with no key combinations.Unlocking the bootloaderIt's only possible to flash a custom system if the bootloader allows it.This is the default setup on ADP1 and ADP2.On Nexus One, Nexus S, Nexus S 4G, and Galaxy Nexus, the bootloader is locked by default. With the device in fastboot mode, the bootloader is unlocked with$ fastboot oem unlockThe procedure must be confirmed on-screen, and deletes the user data for privacy reasons. It only needs to be run once.On Nexus One, the operation voids the warranty and is irreversible.On Nexus S, Nexus S 4G, and Galaxy Nexus, the bootloader can be locked back with$ fastboot oem lockObtaining proprietary binariesStarting with IceCreamSandwich, the Android Open-Source Project can't be used from pure source code only, and requires additional hardware-related proprietary libraries to run, specifically for hardware graphics acceleration.Official binaries for Nexus S, Nexus S 4G, Galaxy Nexus, and PandaBoard can be downloaded from Google's Nexus driver page, which add access to additional hardware capabilities with non-Open-Source code.There are no official binaries for Nexus One, ADP2 or ADP1.Extracting the proprietary binariesEach set of binaries comes as a self-extracting script in a compressed archive. After uncompressing each archive, run the included self-extracting script from the root of the source tree, confirm that you agree to the terms of the enclosed license agreement, binaries and their matching makefiles will get installed in the vendor/ hierarchy of the source tree.There's an additional step on Nexus S 4G. Build the signapk tool with$ make signapkThen reassemble the proprietary applicatons with$ vendor/samsung/crespo4g/reassemble-apks.shCleaning up when adding proprietary binariesIn order to make sure that the newly installed binaries are properly taken into account after being extracted, the existing output of any previous build needs to be deleted with$ make clobberPicking and building the configuration that matches a deviceThe steps to configure and build the Android Open-Source Project are described in the page about Building.The recommended builds for the various devices are available through the lunch menu, accessed when running the lunch command with no arguments:Device Branch Build configurationmaguro android-4.0.1_r1full_maguro-userdebugpanda master full_panda-engcrespo android-2.3.6_r1full_crespo-userdebugcrespo4g android-2.3.7_r1full_crespo4g-userdebugpassion android-2.3.6_r1full_passion-userdebugsapphire android-2.2.2_r1full_sapphire-userdebugdream android-2.2.2_r1full_dream-userdebugFlashing a deviceSet the device in fastboot mode if necessary (see above).Because user data is typically incompatible between builds of Android, it's typically better to delete it when flashing a new system.$ fastboot erase cache$ fastboot erase userdataAn entire Android system can be flashed in a single command: this writes the boot, recovery and system partitions together after verifying that the system being flashed is compatible with the installed bootloader and radio, and reboots the system.$ fastboot flashallOn maguro, panda, crespo, crespo4g, sapphire and dream (but not on passion), the commands above can be replaced with a single command$ fastboot -w flashallNexus S, Nexus S 4G and Galaxy Nexus Bootloader and Cell Radio compatibilityOn Nexus S, Nexus S 4G, and Galaxy Nexus, each version of Android has only been thoroughly tested with on specific version of the underlying bootloader and cell radio software. However, no compatibility issues are expected when running newer systems with bootloaders and radio images according to the following tables.Nexus S (worldwide version "XX"):Android Version Preferred Bootloader Preferred Radio Also possible2.3 (GRH55)I9020XXJK1I9020XXJK82.3.1 (GRH78)I9020XXJK1I9020XXJK82.3.2 (GRH78C)I9020XXJK1I9020XXJK82.3.3 (GRI40)I9020XXKA3I9020XXKB1All previous versions2.3.4 (GRJ22)I9020XXKA3I9020XXKD1All previous versions2.3.5 (GRJ90)I9020XXKA3I9020XXKF1All previous versions2.3.6 (GRK39F)I9020XXKA3I9020XXKF1All previous versionsNexus S (850MHz version "UC"):Android Version Preferred Bootloader Preferred Radio Also possible2.3.3 (GRI54)I9020XXKA3I9020UCKB22.3.4 (GRJ22)I9020XXKA3I9020UCKD1All previous versions2.3.5 (GRJ90)I9020XXKA3I9020UCKF1All previous versions2.3.6 (GRK39C)I9020XXKA3I9020UCKF1All previous versions2.3.6 (GRK39F)I9020XXKA3I9020UCKF1All previous versionsNexus S (Korea version "KR"):Android Version Preferred Bootloader Preferred Radio Also possible2.3.3 (GRI54)I9020XXKA3I9020KRKB32.3.4 (GRJ22)I9020XXKA3M200KRKC1All previous versions2.3.5 (GRJ90)I9020XXKA3M200KRKC1All previous versions2.3.5 (GRJ90)I9020XXKA3M200KRKC1All previous versionsAndroid Version Preferred Bootloader Preferred Radio Also possible2.3.6 (GRK39F)I9020XXKA3M200KRKC1All previous versionsNexus S 4G:Android Version Preferred Bootloader Preferred Radio Also possible2.3.4 (GRJ06D)D720SPRKC5D720SPRKC92.3.4 (GRJ22)D720SPRKC5D720SPRKD8All previous versions2.3.5 (GRJ90)D720SPRKC5D720SPRKE5All previous versions2.3.7 (GWK74)D720SPRKE1D720SPRKH1 (*)All previous versionsGalaxy Nexus (GSM/HSPA+):Android Version Preferred Bootloader Preferred Radio Also possible4.0.1 (ITL41D)PRIMEKJ10I9250XXKK1If you're building a new version of Android, if your Nexus S, Nexus S 4G or Galaxy Nexus has an older bootloader and radio image that is marked as being also possible in the table above but is not recognized by fastboot, you can locally delete the bootloader and version-baseband lines in device/samsung/crespo/board-info.txt or device/samsung/crespo4g/board-info.txt ordevice/samsung/maguro/board-info.txt(*) As a note, radio version D720SPRKH1 for Nexus S 4G sometimes erroneously reports version D720SPRKE1. If this is the case for your Nexus S 4G, you can locally modify the version-baseband line in device/samsung/crespo4g/board-info.txt accordingly.⼀. 环境准备。

ubuntu下android源码编译修改遇到到问题及解决办法

ubuntu下android源码编译修改遇到到问题及解决办法
8. 源码中存放app到路径 out/target/product/generic/system/app
刷机时,该路径中到apk都会成为系统自带应用。
9. 错误: ./adb devices 提示???????????? no permissions
----解决办法:切换到root用户,使用adb kill-server, adb start-server 就可以了
build下的一个文件:
source build/envsetup.sh (前面要加上source,否则找不到mmm等命令)(不同的shell窗口都得运行该命令后才能使用mmm等命令)
b. 使用mmm命令来编译指定的模块,例如QuickSearchBox应用程序:
//注释 ~/Android/out/host/linux-x86/bin有我们要执行的emulator命令,而~/Android/out/target/product/generic是Android镜像存放目录,下面执行emulator命令时会用到。
emulator
adb -s emulator-5554 install -r ebook.apk
在真机上重新安装ebook.apk
adb -s HT9BYL904399 install -r ebook.apk
在emulator-5554模拟器上卸载ebook.apk(不保留数据和缓冲目录)
adb -s emulator-5554 uninstall net.blogjava.mobile.ebook
02-23 11:11:16.719: I/EasouSearch(2741): http get::8080/oss/upload/QuickSearchBox.apk

ubuntu下编译android源码错误解决记录

ubuntu下编译android源码错误解决记录

数据库系统管理制度数据库系统管理制度是指为了保障数据库系统的安全、稳定和高效运行,而制定的一系列规章制度和管理措施。

合理的数据库系统管理制度可以提高数据库系统的可靠性,保护数据的安全性,防止数据丢失和泄露,提高数据的完整性、一致性和可用性。

以下是数据库系统管理制度的一些要点:一、数据库系统管理的基本原则1.安全原则:确保数据库系统的安全,防止数据被非法拷贝、篡改或泄露。

2.稳定原则:保证数据库系统的稳定运行,防止系统故障和服务中断。

3.效率原则:提高数据库系统的运行效率,保证用户可以快速访问和处理数据。

4.合规原则:遵守相关法律法规和企业规定,保护用户隐私和敏感数据。

二、数据库系统管理的组织机构和职责1.数据库管理员(DBA)的职责:负责数据库系统的安装、配置、备份和恢复,监控系统性能,并对系统进行优化,管理用户的账号和权限,解决数据库系统相关的问题。

2.安全管理员的职责:负责数据库系统的安全策略和控制策略的制定和执行,制定用户权限管理规则,监控和审计数据库系统的访问和活动,检查和处理安全漏洞。

3.运维人员的职责:负责日常维护工作,包括系统巡检、性能监控、问题排查和解决,数据库备份和恢复等。

三、数据库系统管理的技术标准和流程1.数据库系统的选择和部署标准:根据业务需求和安全要求,选择合适的数据库系统,并根据标准化的部署流程进行安装和配置。

2.数据库系统的备份和恢复标准:制定定期备份数据库和日志的策略,保证数据不丢失,同时确保备份的可靠性和完整性。

3.数据库系统的安全管理标准:建立用户权限管理体系,对数据库用户进行分类和授权,限制用户的访问权限,定期修改密码,确保数据库系统的安全性。

4.数据库系统的性能管理标准:监控数据库系统的性能指标,定期进行性能优化,包括索引优化、SQL语句优化、硬件升级等,提高数据库系统的响应速度和并发能力。

5.数据库系统的故障处理标准:建立故障处理流程,监控系统运行状态,及时发现和解决故障,确保系统可用性。

在Ubuntu上下载、编译和安装Android最新内核源代码(Linux Kernel)

在Ubuntu上下载、编译和安装Android最新内核源代码(Linux Kernel)

在前一篇文章提到,从源代码树下载下来的最新Android源代码,是不包括内核代码的,也就是Android源代码工程默认不包含Linux Kernel代码,而是使用预先编译好的内核,也就是prebuilt/android-arm/kernel/kernel-qemu文件。

那么,如何才能DIY自己的内核呢?这篇文章一一道来。

一. 首选,参照前一篇在Ubuntu上下载、编译和安装Android最新源代码准备好Android源代码目录。

二. 下载Linux Kernel for Android源代码。

1. 使用GIT工具下载,执行以下命令:USER-NAME@MACHINE-NAME:~/Android$ mkdir kernelUSER-NAME@MACHINE-NAME:~/Android$ cd kernelUSER-NAME@MACHINE-NAME:~/Android/kernel$ git clonegit:///kernel/common.git同样是经过漫长的等待后,在kernel目录下有一个common目录,Linux内核代码就在这里了。

2. 下载完成后,可以查看下载的内核代码版本:USER-NAME@MACHINE-NAME:~/Android/kernel$ cd commonUSER-NAME@MACHINE-NAME:~/Android/kernel/common$ git branch android-2.6.363. 下载完Android的Linux内核代码后,会发现在arch/arm/configs下没有模拟器要使用的硬件配置文件goldfish_defconfig,而这个配置文件是编译内核代码时需要用到的,因此,需要checkout goldfish版本:USER-NAME@MACHINE-NAME:~/Android/kernel/common$ git branch -a * android-2.6.36remotes/origin/HEAD -> origin/android-2.6.36remotes/origin/android-2.6.35remotes/origin/android-2.6.36remotes/origin/archive/android-2.6.25remotes/origin/archive/android-2.6.27remotes/origin/archive/android-2.6.29remotes/origin/archive/android-2.6.32remotes/origin/archive/android-gldfish-2.6.29remotes/origin/archive/android-goldfish-2.6.27选择android-gldfish-2.6.29:USER-NAME@MACHINE-NAME:~/Android/kernel/common$ git checkoutremotes/origin/archive/android-gldfish-2.6.29下载完毕后,就能在arch/arm/configs下看到goldfish_defconfig这个文件了。

Ubuntu下编译Android源码全过程

Ubuntu下编译Android源码全过程

Ubuntu下编译Android源码全过程(转)源码, 编译, Ubuntu, Android一、获取Android源代码Git是LinuxTorvalds(Linux之父)为了帮助管理Linux内核开发而开发的一个开放源码的分布式版本控制软件,它不同于Subversion、CVS这样的集中式版本控制系统。

在集中式版本控制系统中只有一个仓库(Repository),许多个工作目录(WorkingCopy),而在Git这样的分布式版本控制系统中(其他主要的分布式版本控制系统还有BitKeeper、Mercurial、GNUArch、Bazaar、Darcs、SVK、Monotone等),每一个工作目录都包含一个完整仓库,它们支持离线工作,本地提交可以稍后提交到服务器上。

因为Android是由Kernel、Dalvik、Bionic、Prebuilt、build等多个项目组成,如果我们分别使用Git来逐个获取显得很麻烦,所以Android项目编写了一个名为Repo的Python 的脚本来统一管理这些项目的仓库,使得项目的获取更加简单。

在Ubuntu 8.04上安装Git只需要设定正确的更新源,然后使用apt-get就可以了,apt-get 是一条Linux命令,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。

apt-get命令一般需要root权限执行,所以一般跟着sudo命令。

sudo apt-get install git-core curl这条命令会从互联网的软件仓库中安装git-core和curl。

其中curl是一个利用URL语法在命令行方式下工作的文件传输工具,它支持很多协议,包括FTP、FTPS、HTTP、HTTPS、TELENT等,我们需要安装它从网络上获取Repo脚本文件。

curl/repo>~/bin/repo这句命令会下载repo脚本文件到当前主目录的/bin目录下,并保存在文件repo中。

Ubuntu下Android源码修改编译及运行launcher定制

Ubuntu下Android源码修改编译及运行launcher定制

Ubuntu下Android源码修改编译及运行launcher定制在Ubuntu下进行Android源码的修改、编译和运行,以及定制launcher,需要以下步骤:1.安装必要的软件和依赖项:在Ubuntu终端中输入以下命令来安装必要的软件和依赖项:```sudo apt-get updatesudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \libgl1-mesa-dev libxml2-utils xsltproc unzip``````mkdir ~/android-sourcecd ~/android-sourcerepo sync```3.修改源码:进入源代码的根目录:```cd ~/android-source```进行所需的修改,如添加新功能、修改界面等。

4.编译源码:在源码目录下执行以下命令以编译源码:```. build/envsetup.shlunchmake````lunch`命令会提示选择要编译的目标平台和设备,选择相应的选项后执行`make`命令进行编译。

5. 运行Android模拟器或设备:在源码目录下执行以下命令来运行Android模拟器或设备:```emulator```或者连接一台Android设备并执行以下命令:```adb devicesadb shell```6. 定制Launcher:Launcher是Android系统的主屏界面,可以对其进行定制以满足特定需求。

以下是一些定制Launcher的方法:- 修改源码中Launcher的布局和样式:可以修改源码中的布局文件和样式文件来改变Launcher的外观。

ubuntu 下编译android4.0

ubuntu 下编译android4.0

ubuntu 下编译android4.0(顺便谈谈国产平板android4.0一些被误解的观点)其实,android 4.0发布之后的几天就想编译出来体验一下ICS,事情多得一直拖到今天,另外一些误导人的传闻越来越凶,说什么编译环境最低要求memory为16G。

今天就拿实验室的机器跑了一通,编译无不良反映,一切正常。

简单说说机器的环境:1CPU:i7 2600(8线程)2Memory:4G3System:ubuntu 10.04(64位)虽然说机器的内存相对于CPU来说偏低了,但是我之前编译android 2.3时,也就半个小时左右。

ICS的话,估计也能完成,时间问题而已。

至于为什么用ubuntu 10.04 (64位),因为学校用的是史上最变态无聊的drcom,没找到ubuntu 11.10的64位版本,32位倒是有。

还有一点的是ubuntu 11.10的gcc版本更新了,编译过程中会出现一些errors,不过很简单就可以解决的。

Android 4.0的源代码压缩包可以去去下载,下载后解压缩(tar vxzf)即可,解压之后一共有4.7G。

4build/core/main.mk编译之前要安装一些依赖包什么的,还有JDK之类的东西。

因为之前编译过android的源代码,机器已经安装了,而且是64bit的系统,所以在terminal转到源代码目录下,直接make即可,要修改编译中分配的线程的话,make –jN即可,N为线程数。

e.g :5make –j6-------------编译准备工作------------------------------------------------------------------附上需要安装的依赖:6$ sudo apt-get update7$ sudo apt-get -y install git-core8$ sudo apt-get -y install gnupg9$ sudo apt-get -y install sun-java6-jdk flex10$ sudo apt-get -y install bison11$ sudo apt-get -y install gperf12$ sudo apt-get -y install libsdl-dev13$ sudo apt-get -y install libesd0-dev14$ sudo apt-get -y install libwxgtk2.6-dev15$ sudo apt-get -y install build-essential16$ sudo apt-get -y install zip17$ sudo apt-get -y install curl18$ sudo apt-get -y install libncurses5-dev19$ sudo apt-get -y install zlib1g-dev20$ sudo apt-get -y install valgrind(如果是32bit的系统的话,则要更改几个Android.mk文件)21/external/clearsilver/cgi/Android.mk22/external/clearsilver/java-jni/Android.mk23/external/clearsilver/util/Android.mk24/external/clearsilver/cs/Android.mk用gedit打开,修改m64为m32即可另外25build/core/main.mk也要把26ifneq (64,$(findstring 64,$(build_arch)))修改为27ifneq (i686,$(findstring i686,$(build_arch)))----------------编译过程------------------------------------------------------------------在terminal中28$make编译开始……可以看到platform version为4.0.1,然后开始漫长的等待。

在Ubuntu上编译Android Gingerbread 2.3.1

在Ubuntu上编译Android Gingerbread 2.3.1
Ubuntu
Android Gingerbread 2.3.1
Ubuntu 10.04(32 )
Android 2.3.1
Android
[
]
个别个su里o个apt需tu里e个需nsta首首个错需t-部ore个错nup错个f首ex个速需son个错perf个首需速s里首-里ev个 首需速es里已-里ev个首需速wx错t项快官提-里ev个速u需首里-essent需a首个z需p个部ur首个首需速n部urses持-里ev个 z首需速开错-里ev个个
[ Android ]
别个验a项e个-面路错rep个命误pro部essor命个就pro部就部pu需nfo个|个w部个-首路个个
-j CPU make -j2( ) CPU
************************************************************
You are attempting to build on a 32-bit system.
repo Google Python Git
别个部里个~个 别个验项里需r个速需n个 别个部ur首个长ttp果就就an里ro需里官错需t官项erne首官or错就repo个此~就速需n就repo个 别个部长验o里个a天x个~就速需n就repo个个
repo ~/.bashrc
P源T由=别P源T由果~就速需n个 export个P源T由个个
out/target/product/generic
~/.bashrc export PATH=$PATH:/home/android/gingerbread/out/host/linux-x86/bin export ANDROID_PRODUCT_OUT=/home/android/gingerbread/out/target/product/generic source ~/.baserc emulator

ubuntu12.04编译android4.1.1_r6源代码步骤

ubuntu12.04编译android4.1.1_r6源代码步骤

废话不多说,直接发过程.以下是笔者编译环境(仅供参考):硬件平台:CPU:Intel® Core™ i3-2310M CPU @ 2.10GHz × 4内存:4GB硬盘:100G操作系统:Ubuntu 12.04(64-bit)一、准备工作1.安装必要的软件:Python2.5-2.7 (必须是2.5-2.7否则执行repo脚本会出错,系统自带2.7)GNU Make 3.81-3.82(系统自带)JDK6(3.2.x以上版本用JDK6或更高,3.2.x以下的版本可用JDK5,JDK版本必须选择正确,否则编译出错)。

Git 1.7(手动安装)2.安装必须的包:$ sudo apt-get install git-core gnupg flex bison gperf \build-essential zip curl libc6-dev libncurses5-dev:i386 \x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 \tofrodos python-markdown libxml2-utils xsltproc \zlib1g-dev:i386 libsdl1.2-dev libesd0-dev libwxgtk2.8-dev \ia32-libs$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1/usr/lib/i386-linux-gnu/libGL.so3.安装GCC因为ubuntu12.04已经自带gcc版本为4.6,所以只需要确认即可。

4.安装JDK1.6官方教程上的安装方式已经不管用了,需要自己下载安装。

官网:/technetwork/java/javase/downloads/index.html下载jdk-6u37-linux-x64.bin安装过程详解:1.授权运行文件(实际路径以你自己为准,这是我的目录哦)$ sudo chmod u+x /home/zlk/Downloads/jdk-6u37-linux-x64.bin2.安装jdk$ sudo ./home/zlk/Downloads/jdk-6u37-linux-x64.bin3.拷贝jdk1.6.0_37到/usr/lib/jvm这一步需要超级文件浏览权限,先拷贝要粘贴的文件之后再输入下面的命令,之后将jdk1.6.0_37文件夹粘贴到/usr/lib/jvm目录中。

Ubuntu下编译Android及安装

Ubuntu下编译Android及安装

Ubuntu环境下编译Android源码及安装本次实验环境为Ubuntu10.04、Android版本为2.1,采用的是ARM9 Mini6410开发板自带的Android源码。

其它版本尚未测试,不过原理类似。

第一步:准备JDK环境Android源码有部分是用Java编写的,所以编译Android源码前,必须安装Java类库,即JDK。

编译Android源码需要JDK1.5版(主要是需要其中的javadoc),1.6版是不兼容的。

JDK1.5已经停止支持,其最终的版本是JDK 5.0 Update 22安装JDK有两种方法(推荐第二种):方法一,自己下载jdk可从Sun官网上下载:/javase/downloads/5u22/jdk 选择平台Linux,勾选同意许可协议:单击Continue,在弹出的页面中一共有两个下载,选第一个jdk-1_5_0_22-lin ux-i586.bin下载:方法二,用apt-get命令首先,打开/etc/apt/sources.list文件,打开时注意,无论用vim还是gedit命令,都要在前面加上sudo,如sudo vim /etc/apt/sources.list,不然没法保存。

然后,将下面语句添加到文件末尾,注意空格deb /ubuntu/ jaunty multiversedeb /ubuntu/ jaunty-updates multiverse 最后,分别执行如下命令sudo apt-get updatesudo apt-get install sun-java5-jdk因为,要从网上下载安装包,所以时间可能比较长,请耐心等待。

安装过程中,会弹出一个许可证说明书,按Tab切换,选择Yes,等待安装完成即可。

第二步:安装编译所需的包分别执行一下命令(注意空格):sudo apt-get install git-core flex bison gperf libesd0-dev zipsudo apt-get install libwxgtk2.6-dev zlib1g-dev build-essential libstdc++6sudo apt-get install tofrodos x-dev libx11-dev libncurses5-dev第三步:编译源码首先,解压源码,本例中源码路径为/home/user/Android/android-2.1-fs-20100815.tar.gz ,切换到源码包目录执行sudo tar xzvf android-2.1-fs-20100815.tar.gz ,在当前目录会生成一个Android文件夹,里面存放着解压出来的所有源码。

Ubentu编译Android源码(AOSP)

Ubentu编译Android源码(AOSP)

Ubentu编译Android源码(AOSP)前⾔:⼀直想要编译⼀下Android 源码,之前去google 看,下载要下载repo。

当时很懵逼,repo 是个什么?(repo 是⼀个python 脚本,因为Android 源码git 仓库太多,帮助管理git 仓库的,你不需要知道⾥⾯什么实现。

会⽤就⾏。

)然后往下看,看到⽹上说,编译Android AOSP 只能⽤Ubuntu,当时⾃⼰的⼼也哇哇凉啊。

⾃⼰只有⼀个⼯作的电脑,⾃⼰的电脑配置太低。

看⽹上说,还要200G 的空间。

(有⼀个拦路虎)之前⾃⼰给⾃⼰的windos 安装过双系统,但是好像⼀直启动不了。

现在想想,应该是因为当时没有设置引导盘的顺序吧。

现在我⽤⼀个usb 连接了⼀个1T的硬盘,⾥⾯安装了Ubentu . 如果我插了这个硬盘,启动的就是ubuntu, 如果没有,就是⼯作的windows 。

⼯作学习两不误。

不知道什么动⼒让我突破了所有上⾯的拦路虎,依然决然去编译源码。

⾯试的时候,别⼈提到过,我说我想,但是没有做到,别⼈说,那么你为了编译源码,你第⼀步应该怎么做? 我说⾸先下载源码,安装Ubuntu。

终于⼀步⼀步⾛过来了。

感谢⾯试的那个⼈给我指点,让我思考。

⼀路⾛来,少些艰⾟。

下载代码⽤了两天,还是下载的清华镜像的,公司的⽹太慢了,43G 下载了两天,然后正好周末,编译成功花费了两天周末时间,但是还是很值得的。

⾥⾯有很多坑,给⼤家分享下。

下载AOSP:google 的AOSP 的话,因为FQ和数据量太⼤,考虑国内的镜像。

这个⽹址是清华⼤学的镜像站。

由于⾸次同步需要下载约 30GB 数据,过程中任何⽹络故障都可能造成同步失败,我们强烈建议您使⽤初始化包进⾏初始化。

也就是我们直接下载⼀个git仓库。

这样的话,不会说,⽂件太⼤,git clone 的时候⽼是中断。

下载下载完成后记得根据 checksum.txt 的内容校验⼀下。

当时我是⽤Windows 迅雷下载的⽂件。

Ubuntu下编译Android源码并运行Emulator 2

Ubuntu下编译Android源码并运行Emulator 2

Ubuntu下编译Android源码并运行Emulator 2//apt-get autoremove sun-java5-jdk//apt-get install nautilus-open-terminalandroid源码的编译安装虚拟机时建议设置空间为16G左右,否则后面编译源代码可能会导致空间不够编译环境:Ubuntu8.101、安装一些环境sudo apt-get install build-essential //sudo apt-get install makesudo apt-get install gccsudo apt-get install g++ //sudo apt-get install libc6-devsudo apt-get install patch //sudo apt-get install texinfo //sudo apt-get install libncurses-dev //sudo apt-get install git-core gnupg //sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl sudo apt-get install ncurses-devsudo apt-get install zlib1g-devsudo apt-get install valgrindsudo apt-get install python2.5安装java环境sudo apt-get install sun-java5-jdk不要用sun-java6-jdk,否则会有问题2、设置环境变量vim ~/.bashrc在.bashrc中新增或整合PA TH变量,如下#java 程序开发/运行的一些环境变量在home/你的用户名/.bashrc中加入下面一些,有些是后面运行编译后的模拟器而用的export JA VA_HOME=usr/lib/jvm/java-1.5.0-sunexport JRE_HOME=usr/lib/jvm/java-1.5.0-sun/jreexport PA TH=$PATH JA V A_HOME/binexport PA TH=$PATH:~/mydroid/out/host/linux-x86/binexport ANDROID_PRODUCT_OUT=~/mydroid/out/target/product/genericexport CLASSPATH=.{JA V A_HOME}/lib JRE_HOME/lib CLASSPATHexport JA VA_PATH=${JA V A_HOME}/bin{JRE_HOME}/binHOME_BIN=~/bin/export PA TH=${PATH}{JA V A_PA TH}{JRE_PATH}{HOME_BIN};3、安装repo(用来更新android源码)创建~/bin目录,用来存放repo程序,如下:$ cd ~$ mkdir bin注意:下载后的.repo也许并不在这个文件夹中,请返回上一级目录找到后拷贝至此下载repo脚本并使其可执行:$ curl /repo >~/bin/repo$ chmod a+x ~/bin/repo4、下载android源码并更新之$ mkdir mydroid$ cd mydroid方式一建议不要用repo来下载(android源码超过1G,非常慢),直接在网上下载http: ///bbs/pub/cupcake.tar.gz。

在ubuntu16.04上编译安卓5.1的过程

在ubuntu16.04上编译安卓5.1的过程

sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev sudo apt-get install git-core gnupg flex bison gperf build-essential sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib sudo apt-get install libc6-dev-i386 sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo apt-get install lib32z-dev ccache sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 注:Ubuntu 版本不同,依赖的软件也不一样。
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.7 g++-4.7 g++-4.7-multilib gcc-4.7-multilib
2)Ubuntu16.04 环境下,推荐安装 make-3.8 版本
2)设置 JDK 环境变量
sudo gedit /etc/profile 在文件末尾加上: Export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/ Export JRE_HOME=${JAVA_HOME}/jre Export CLASSPATH=.:${JAVA_HOME}/lib:{JRE_HOME}/lib Export PATH=${JAVA_HOME}/bin:$PATH 修改了/etc/profile 文件需要重启才能生效

Ubuntu下编译Android源码并运行Emulator2

Ubuntu下编译Android源码并运行Emulator2

Ubuntu下编译Android源码并运行Emulator2Ubuntu下编译Android源码并运行Emulator2在Ubuntu上编译和运行Android源码并运行Emulator需要一些准备工作和步骤,下面是详细的步骤说明。

准备工作:1.安装必要的依赖项:- Java Development Kit (JDK): 通过运行`sudo apt-get install openjdk-8-jdk`命令安装Java开发工具包。

- Git: 运行`sudo apt-get install git`命令安装Git。

- 必要的库和工具: 运行`sudo apt-get install libx11-dev libxext-dev libxi-dev libxrender-dev libxtst-dev libxt-dev libcups2-dev libncurses5-dev libgnome2-0 libgnomeui-0 libgtk2.0-0 libatk1.0-0 libbonoboui2-0 libcairo2 libfontconfig1-devlibxslt-dev libxml2-dev libcurl4-openssl-dev libusb-1.0-0-dev libgtk2.0-bin libdbus-1-dev libdbus-glib-1-dev libgconf2-dev libnss3-dev automake libtool pkg-config`命令安装必要的库和工具。

2. 安装Repo及相关工具:编译源码:1. 初始化环境:运行`. build/envsetup.sh`命令初始化环境。

2. 选择目标设备:运行`lunch`命令选择目标设备,例如选择"2.修改设备名-eng"即选择修改设备名为eng类型的目标设备。

3. 编译源码:运行`make -j4`命令开始编译源码,-j4参数可以指定并行编译的线程数,可以根据系统配置适当调整。

ubuntu环境下反编译androidapk的方法

ubuntu环境下反编译androidapk的方法

ubuntu环境下反编译androidapk的⽅法使⽤ApkTool反编译Apk下载 apktool1.4.3.tar.bz2 、apktool-install-linux-r04-brut1.tar.bz2 两个包,并解压到统⼀个⽬录中,解压后得到aapt apktool apktool.jar 。

解压安装完成后输⼊以下命令解压:<span>$ ./apktool d apk/xgd_android_test.apkI: Baksmaling...I: Loading resource table...I: Loaded.I: Loading resource table from file: /home/yangyupeng/apktool/framework/1.apkI: Loaded.I: Decoding file-resources...W: Cant find 9patch chunk in file: "drawable-mdpi/navbar.9.png". Renaming it to *.png.I: Decoding values*/* XMLs...I: Done.I: Copying assets and libs...</span>显⽰如上,注意apktool的参数,d表⽰decode,b表⽰build,此时在当前⽬录⽣成apk的解压⽂件:1/xgd_android_test$ lsAndroidManifest.xml apktool.yml lib res smali这⾥有apk的源码(smali)、图⽚、xml配置和语⾔配置等等信息。

使⽤dex2jar和JD-JUI这两个⼯具查看java源码下载dex2jar、JD-JUI 两个包,解压。

把apk的后缀名改成zip,并解压得到classes.dex⽂件,在dex2jar⽬录中输⼊如下命令得到.jar⽂件:<span>$ ./dex2jar.sh classes.dexthis cmd is deprecated, use the d2j-dex2jar if possibledex2jar version: translator-0.0.9.9dex2jar classes.dex -> classes_dex2jar.jarDone.</span>再使⽤JD-JUI打开该⽂件就能查看源代码:与源代码对⽐:package xgd.android;import android.app.Activity;import android.os.Bundle;public class ICCardActivity extends Activity{@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(yout.iccard);}}总结以上就是这篇⽂章的全部内容了,希望本⽂的内容对⼤家的学习或者⼯作具有⼀定的参考学习价值,谢谢⼤家对的⽀持。

在Ubuntu上编译android

在Ubuntu上编译android

在Ubuntu7.10上编译android1 概述上个星期看到android开放源代码的消息,虽然觉得Google的这个动作会对业界产生很大影响,但没有时间仔细看,只浏览了Project layout。

今天上午一个网友在mail中说已经编译、运行过android。

我趁着中午休息时间,在一个Ubuntu7.10的虚拟机上编译、运行了一下。

我在这个虚拟机上编译过openmoko、poky。

相对于这两个使用OpenEmbedded的平台,android的编译要简单一些,快一些。

我在编译openmoko和poky时,将所有下载包都保存在一个目录中,将编译目录的sources子目录指向这个目录。

这样做,一方面即使以后有些链接失效,也还可以编起来(其实编译时都不需要连接外网);另一方面在重新编译时,不用重新下载,可以加快编译速度。

即使这样,完全编译一次poky也要一个晚上。

编译android时,下载用了1个小时,编译也只需要1个小时。

2 编译中的两个小问题2.1 python和JDKGoogle网站对编译过程的介绍还是很清晰的。

不过在介绍其它软件包时,都给出了apt-get命令,却单独给出了python和JDK的链接地址,容易对读者产生误导,以为要手工安装这两个软件。

其实这两个软件也应该通过apt-get安装。

特别是python,如果从源代码安装,可能因为依赖其它软件,导致一些组件编译失败,影响android的编译。

而且python 2.6的源代码包没有提供make uninstall,卸载也比较麻烦。

其实我们只需要一个apt-get命令,就可以安装所有依赖的软件。

2.2 "fatal: git 1.5.4 or later required"在Ubuntu7.10上执行repo init时,会出现"fatal: git 1.5.4 or later required"的错误提示。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

在Ubuntu7.10上编译android1 概述上个星期看到android开放源代码的消息,虽然觉得Google的这个动作会对业界产生很大影响,但没有时间仔细看,只浏览了Project layout。

今天上午一个网友在mail中说已经编译、运行过android。

我趁着中午休息时间,在一个Ubuntu7.10的虚拟机上编译、运行了一下。

我在这个虚拟机上编译过openmoko、poky。

相对于这两个使用OpenEmbedded的平台,android的编译要简单一些,快一些。

我在编译openmoko和poky时,将所有下载包都保存在一个目录中,将编译目录的sources子目录指向这个目录。

这样做,一方面即使以后有些链接失效,也还可以编起来(其实编译时都不需要连接外网);另一方面在重新编译时,不用重新下载,可以加快编译速度。

即使这样,完全编译一次poky也要一个晚上。

编译android时,下载用了1个小时,编译也只需要1个小时。

2 编译中的两个小问题2.1 python和JDKGoogle网站对编译过程的介绍还是很清晰的。

不过在介绍其它软件包时,都给出了apt-get命令,却单独给出了python和JDK的链接地址,容易对读者产生误导,以为要手工安装这两个软件。

其实这两个软件也应该通过apt-get安装。

特别是python,如果从源代码安装,可能因为依赖其它软件,导致一些组件编译失败,影响android的编译。

而且python 2.6的源代码包没有提供make uninstall,卸载也比较麻烦。

其实我们只需要一个apt-get命令,就可以安装所有依赖的软件。

2.2 "fatal: git 1.5.4 or later required"在Ubuntu7.10上执行repo init时,会出现"fatal: git 1.5.4 or later required"的错误提示。

在Ubuntu8.04上编译没有这个问题。

下面的流程里会介绍怎样解决这个问题。

3 在Ubuntu7.10上的编译流程3.1 安装依赖的软件执行sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl python sun-java5-jdk valgrind3.2 安装脚本repocd ~mkdir binexport PATH=$PATH:~/bincurl /repo >~/bin/repochmod a+x ~/bin/repo将repo所在目录加到PATH后就可以在其它目录直接执行。

3.3 初始化代码仓库我把/ui/mydroid作为工作目录,创建目录后在这个目录执行:repo init -u git:///platform/manifest.git 如果返回"fatal: git 1.5.4 or later required",就执行3.4。

否则执行3.5。

3.4 “fatal: git 1.5.4 or later required”的解决3.4.1 删除git-core,添加apt源首先执行sudo apt-get remove git-core再编辑apt的源文件sudo vi /etc/apt/sources.list在最后添加deb /debian/ etch-backports maindeb-src /debian/ etch-backports main然后执行sudo apt-get update更新源。

这时如果出现没有公钥的错误提示:“由于没有公钥,下列签名无法进行验证:NO_PUBKEY EA8E8B2116BA136C”,就执行3.4.2。

否则执行3.4.3。

3.4.2 安装公钥执行gpg命令下载公钥:sudo gpg --keyserver --recv-keys EA8E8B2116BA136C sudo gpg --export -a EA8E8B2116BA136C > /tmp/key添加公钥:sudo apt-key add /tmp/key3.4.3 更新git-core执行:sudo apt-get updatesudo apt-get install debian-backports-keyringsudo apt-get updatesudo apt-get -t etch-backports install git-core然后再执行:repo init -u git:///platform/manifest.git应该就可以了。

3.5 下载代码执行repo sync下载代码。

我从13:30执行这条命令,14:30完成下载。

3.6 编译执行make编译。

我从14:30开始编译,15:40左右完成。

编译的最后输出是:Install system fs image: out/target/product/generic/system.imgTarget ram disk: out/target/product/generic/ramdisk.imgTarget userdata fs image: out/target/product/generic/userdata.img4 执行可以用模拟器运行一下刚才编译的映像。

从网上下载一个android-sdk-linux_x86-1.0_r1.zip,我将其放到~/android目录解压。

在路径中增加sdk的tools目录:export PATH=${PATH}:~/android/android-sdk-linux_x86-1.0_r1/tools通过环境变量告诉模拟器映像所在的目录:export ANDROID_PRODUCT_OUT=/ui/mydroid/out/target/product/generic最后执行:emulator就可以了。

可以用-skin参数选择皮肤。

sdk的tools/lib/images/skins目录中是sdk 自带的皮肤。

下面是两个运行的截图:相对于android的java框架,我更喜欢GTK和C。

但不得不承认android的UI比openmoko做得强多了。

5 结束语可以在~/.bashrc的最后添加:export PATH=${PATH}:~/bin:~/android/android-sdk-linux_x86-1.0_r1/tools export ANDROID_PRODUCT_OUT=/ui/mydroid/out/target/product/generic自动设置编译、运行环境。

这两天晚上正在改gsmd的中文短信bug,没时间仔细看android的编译系统,感觉上应该比OpenEmbedded简单。

其实OpenEmbedded用习惯了也不错,就是不够精简,速度慢一些,占用空间大一些。

编译android的工作目录有3.5个G。

我编译poky的目录有10.59个G,编译openmoko的目录有11.6个G。

一、获取Android源代码Git是LinuxTorvalds(Linux之父)为了帮助管理Linux内核开发而开发的一个开放源码的分布式版本控制软件,它不同于Subversion、CVS这样的集中式版本控制系统。

在集中式版本控制系统中只有一个仓库(Repository),许多个工作目录(WorkingCopy),而在Git这样的分布式版本控制系统中(其他主要的分布式版本控制系统还有BitKeeper、Mercurial、GNUArch、Bazaar、Darcs、SVK、Monotone等),每一个工作目录都包含一个完整仓库,它们支持离线工作,本地提交可以稍后提交到服务器上。

因为Android是由Kernel、Dalvik、Bionic、Prebuilt、build等多个项目组成,如果我们分别使用Git来逐个获取显得很麻烦,所以Android项目编写了一个名为Repo的Python的脚本来统一管理这些项目的仓库,使得项目的获取更加简单。

在Ubuntu 8.04上安装Git只需要设定正确的更新源,然后使用apt-get就可以了,apt-get 是一条Linux命令,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。

apt-get命令一般需要root权限执行,所以一般跟着sudo命令。

sudo apt-get install git-core curl这条命令会从互联网的软件仓库中安装git-core和curl。

其中curl是一个利用URL语法在命令行方式下工作的文件传输工具,它支持很多协议,包括FTP、FTPS、HTTP、HTTPS、TELENT等,我们需要安装它从网络上获取Repo脚本文件。

curl/repo>~/bin/repo这句命令会下载repo脚本文件到当前主目录的/bin目录下,并保存在文件repo中。

最后我们需要给repo文件可执行权限chmod a+x ~/bin/repo接下来我们就可以利用repo脚本和Git、curl软件获取Android的源代码了:)首先建一个目录,比如~/android。

然后使用下面命令获取源码:repo init –u git:///platform/manifest.git这个过程会持续很长的时间(笔者下载了一天),下载完毕后会看到repo initialized in/android这样的提示,说明本地的版本库已经初始化完毕,并且包含了当前最新的sourcecode。

如果我们想拿某个分支版本的代码,而不是主线代码,需要使用-b参数指定branch的名字,比如:repo init –u git:///platform/manifest.git –b cupcake如果我们只是想获取某一个project的代码,比如kernel/common,就不需要repo脚本了,直接使用Git工具即可,如果仔细研究repo脚本会发现,repo脚本其实就是组织Git工具去获取各个Project并把它们组织到同一个项目Android内。

git clone git:///kernel/common.git我们上面使用repo脚本获取了各个项目,那么接下来就需要把整个Android代码树同步到本地,如下:repo sync project1 project2 …笔者使用repo sync命令直接同步全部项目到本地。

二、源码编译全部同步完毕后,进入到Android目录下,使用make命令编译,你会发现出现如下错误提示:host C: libneo_cgi这个错误是因为我们缺少zlib1g-dev,需要使用apt-get命令从软件仓库中安装,如下:sudo apt-get install zlib1g-dev同理,我们还需要依次安装如下软件sudo apt-get install flexsudo apt-get install bisonsudo apt-get install gperfsudo apt-get install libsdl-devsudo apt-get install libesd0-devsudo apt-get install libncurses5-devsudo apt-get install libx11-dev以上软件全部安装完毕后,运行make命令再次编译Android源码。

相关文档
最新文档