You are attempting to build with the incorrect version of java.
2011-12-15 09:53
579 查看
You are attempting to build with the incorrect version of java.
Android平台的代码1 安装工具repo :
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
2 下载平台的代码
代码放在/media/H/android下面
1. 创建一个目录,放代码:
mkdir android
cd android
2. 运行 repo init 下载最新的源代码:
repo init -u git://android.git.kernel.org/platform/manifest.git
3. 当提示输入姓名和E-mail时,输入姓名和gmail的邮件地址。成功后会提示如下信息:
repo initialized in /android
4 下载
repo sync
Notes: 如果要下载别的版本的代码,比如cupcake 则在第2步
repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
下载eclair 则
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair
android编译
Host : ubuntu 9.04
Java ,javac 版本 1.6
(一) 源码的编译
编译很简单 直接在android目录下 make ,等上5,6小时就可以了,不过android的编译系统要求java,javac的版本是1.5的,在build/core/main.mk里,
会对java,javac的版本进行检测。如果版本不对,则出现问题:
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.6.0_0".
The correct version is: 1.5.
Please follow the machine setup instructions at
http://source.android.com/download <
4000
br />
solution 1 :编辑 build/core/main.mk
修改
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1/.5[/. "$$]')
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1/.5[/. "$$]')
为
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1/.6[/. "$$]')
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1/.6[/. "$$]')
缺点: 但编译sdk的时候还是会出现问题 。
make sdk
Docs droiddoc: out/target/common/docs/services
javadoc: 错误 - 在 doclet 类 DroidDoc 中,方法 start 已抛出异常 java.lang.reflect.InvocationTargetException
com.sun.tools.javac.code.Symbol$CompletionFailure: 未找到 sun.util.resources.OpenListResourceBundle 的类文件
solition 2:安装1.5版本的jdk:
$ sudo apt-get install sun-java5-jdk flex
$ sudo update-java-alternatives -s java-1.5.0-sun
(二)SDK的编译
在编译完源码后,再执行 make sdk
在out/host/linux-x86/sdk下面有
android-sdk_eng.lawrencekang_linux-x86 android-sdk_eng.lawrencekang_linux-x86.zip sdk_deps.mk
模拟器的运行
现设置好环境变量
export PATH=$PATH:/media/H/android/out/host/linux-x86/bin
export ANDROID_PRODUCT_OUT=/media/H/android/out/target/product/generic
export ANDROID_SWT=/media/H/android/out/host/linux-x86/
然后执行 emulator
用法有:
1 用缺省的virtual device 运行模拟器
emulator
2 用某个皮肤来运行
emulaor -skin QVGA-L
emulator -skin WVGA800 则用WVGA800的皮肤来运行模拟器
但显示 :
emulator: emulator window was out of view and was recentred
我们可以通过-scale 选项来解决这个问题,针对我们这个WVGA skin,用./emulator -skin WVGA -scale 0.9来启动模拟器就没问题了
3 直接指定大小
emulator -skin 800x480
不过google的网站http://developer.android.com/上有这样一段话 :
The Android SDK includes several Emulator skins that you can use to control the resolution and density of the emulated device's screen. To select a specific skin for running the emulator, create an AVD that uses that skin. Please do not use deprecated emulator
options such as -skin to control the skin used by an emulator instance. For more information about AVDs, see Android Virtual Devices.
意思是最好不要用-skin来运行模拟器,而要用-avd
创建avd用的工具是android
android
出现问题:
Error: Error parsing the sdk.
Error: /media/H/androidcupcake/out/host/linux-x86/platforms is missing.
Error: Unable to parse SDK content.
但在out/host/linux-x86/sdk/android-sdk_eng.lawrencekang_linux-x86/tools目录下 ./android 则可以
原来在out/host/linux-x86/sdk/android-sdk_eng.lawrencekang_linux-x86/下面有platforms目录,可见android会查找
上一级目录下的platforms目录
将platforms 和add-ons copy到 out/host/linux-x86下面
然后运行 android就可以了
创建的avd放在 ~/.android/avd下面
假如创建了一个foo ,则emulator -avd foo
模拟器跑起来后 ,还可以用adb shell 来执行 终端命令。
相关文章推荐
- You are attempting to build with the incorrect version of java
- You are attempting to build with the incorrect version of java.
- You are attempting to build with the incorrect version of java.
- 'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.'<>
- 错误 You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work
- Android studio 3.0 Warning:One of the plugins you are using supports Java 8 language features. To t
- Windows下Python3安装BeautifulSoup4显示'You are trying to run the Python 2 version of Beautiful Soup under
- You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.
- Your build host version of Xamarin.IOS (release NO.)is too recent to work with the IOS designer
- INS-35354] The system on which you are attempting to install Oracle RAC is not part of a valid clust
- Windows下使用BeautifulSoup 出现You are trying to run the Python 2 version of Beautiful Soup under Python
- Windows环境下安装beautifulsoup4出现 'You are trying to run the Python 2 version of Beautiful Soup ....错误
- You are using version 6.4.1 of the AdMob SDK which is non-compliant with the Google Play Ad Policy
- You need to run build with JDK or have tools.jar on the classpath.
- OA Framework - How to Find the Correct Version of JDeveloper to Use with E-Business Suite 11i or Release 12.x (Doc ID 416708.1)
- You are attempting to build on a 32-bit system Only 64-bit build environments are supported beyond froyo/2.2
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List
- proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy sub
- 阿里云:CDN:The bucket you are attempting to access must be addressed using the specified endpoint. Plea