`
isiqi
  • 浏览: 16029023 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

You are attempting to build with the incorrect version of java.

阅读更多

Android 入门 (一) 试用
Android的版本
android的版本有很多 0.9 ,1.0 ,1.5,1.6,2.0,2.1
09年4月15日 cupcake android 1.5
09年9月15 Donut android 1.6 : linux内核升级到2.6.29。cdma , wvga ,qvga 的支持
支持OpenCore2媒体引擎 , TTS
09年10月28日 android 2.0  Eclair
支持 HTML5 
     Revamped graphics architecture for improved performance that enables better hardware acceleration.

2010年1月 android 2.1 Flan
        features 和2.0一样,主要是修改一些bugs

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

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 来执行 终端命令。

分享到:
评论

相关推荐

    Java邮件开发Fundamentals of the JavaMail API

    included with the 1.2.1 version of the Java 2 Platform, Enterprise Edition (J2EE), so it is still commonly used. The version of the JavaMail API you want to use affects what you download and install...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The height of the TFlexRegularPolygon object incorrectly changes with its rotation. - FIX: Added division by zero protect in method TFlexControl.MovePathSegment. - FIX: The background beyond ...

    acpi控制笔记本风扇转速

    The debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total Debug ...

    微软内部资料-SQL性能优化2

    If you restart with the 3 GB switch, also known as 4-Gig Tuning, the amount of non-paged pool is reduced to 128 MB from 256 MB. For a process to access 3 GB of address space, the executable image ...

    微软内部资料-SQL性能优化3

    To make use of either more or less strict isolation levels in applications, locking can be customized for an entire session by setting the isolation level of the session with the SET TRANSACTION ...

    Turbo C++ 3.0[DISK]

    If you want to limit the amount of extended memory used by the DPMI-hosted executables, an environment variable called DPMIMEM can be set to do so. For instance, the command set DPMIMEM=MAXMEM 2000 ...

    Turbo C++ 3.00[DISK]

    If you want to limit the amount of extended memory used by the DPMI-hosted executables, an environment variable called DPMIMEM can be set to do so. For instance, the command set DPMIMEM=MAXMEM 2000 ...

    How to install macOS Mojave final 10.14.3 on VirtualBox on Windows

    Moreover, macOS Mojave has consisted of high and nice features that simply enables you to be in grips with it. MacOS Mojave is freshly intercalary dark mode on macOS Mojave. As for several years, ...

    Debugging Malloc Lab: Detecting Memory-Related Errors

    The fact that MyMalloc() and MyFree() are given the filename and line number of the MALLOC() and FREE() call can prove to be very useful when you are reporting errors. The more information you print ...

    Beginning Android 2

    If you are interested in programming for Android, you will need at least a basic understanding of how to program in Java. Android programming is done using Java syntax, plus a class library that ...

    Job-1_ABAQUS_

    abaqus inp 文件源码,需要的可以下载

    Formal Correctness of Security Protocols

    Researchers have been attempting to prove the correctness of various computer system components since the 1970s. Hardware can be verified to a great extent using logic-based tools such as binary ...

    Delphi7.1 Update

    If you have updated any Borland packages in the system32 directory with unofficial patches or updates from CodeCentral, MSI might revert (auto-repair) those packages to their previous version during ...

    Hadoop: The Definitive Guide 3rd_edition

    A few of us were attempting to build an open source web search engine and having trouble managing computations running on even a handful of computers. Once Google published its GFS and MapReduce ...

    SAS Certification Prep Guide-Base Programming for SAS 3rd edition

    Additionally, solutions to all quizzes are included at the back of the book. About This Book.............................................................................................................

    Broadcast Channels

    We introduce the problem of a single source attempting to communicate information simultaneously to several receivers. The intent is to model the situation of a broadcaster with multiple receivers or ...

    TensorFlow For Machine Intelligence

    TensorFlow For Machine Intelligence: A ... Here we first make sure you've had the opportunity to become comfortable with TensorFlow's mechanics and core API before covering machine learning concepts.

    数位板压力测试

    In this document, the words "tablet" and "digitizer" are used interchange¬ably to mean all absolute point¬ing or digitizing devices that can be made to work with this interface. The definition is ...

    TensorFlow Machine Intelligence

    This book is a hands-on introduction to ... Here we first make sure you've had the opportunity to become comfortable with TensorFlow's mechanics and core API before covering machine learning concepts.

Global site tag (gtag.js) - Google Analytics