挂载android分区
sudo hdiutil attach ~/android_code/android7.dmg.sparseimage -mountpoint /Volumes/android
原放入U盘:
echo '188jinghao' | sudo -S hdiutil attach ~/android7.dmg.sparseimage -mountpoint /Volumes/android
放入机械硬盘
sudo hdiutil attach /Volumes/chenjinghao/android7.dmg.sparseimage -mountpoint /Volumes/android7
sudo hdiutil attach /Volumes/chenjinghao/code/android.dmg.sparseimage -mountpoint /Volumes/android
tar -cvf android-6.0.1.tar /Volumes/android/android6_0_1/
启动模拟器
export ANDROID_PRODUCT_OUT=/Volumes/android/android6.0.1/out/target/product/generic
export ANDROID_PRODUCT_OUT_BIN=/Volumes/android/android6.0.1/out/host/linux-x86/bin
export PATH=$PATH:$ANDROID_PRODUCT_OUT_BIN:$ANDROID_PRODUCT_OUT
$cd ~/android/out/host/linux-x86/bin
$ emulator -system system.img -data userdata.img -ramdisk ramdisk.img
export ANDROID_BUILD_TOP=/Volumes/android/android6_0_1
export ANDROID_PRODUCT_OUT=/Volumes/android/android6.0.1/out/target/product/generic
export ANDROID_PRODUCT_OUT_BIN=/Volumes/android/android6.0.1/out/host/darwin-x86/bin
export PATH=$PATH:$ANDROID_PRODUCT_OUT_BIN:$ANDROID_PRODUCT_OUT:$ANDROID_BUILD_TOP
/Volumes/android/android6.0.1/out/host/linux-x86/bin/emulator
-system /Volumes/android/android6.0.1/out/target/product/generic/system.img
-data /Volumes/android/android6.0.1/out/target/product/generic/userdata.img
-ramdisk /Volumes/android/android6.0.1/out/target/product/generic/ramdisk.img
启动模拟器
export ANDROID_BUILD_TOP=/Volumes/android/android7.1.1
export ANDROID_PRODUCT_OUT=/Volumes/android/android7.1.1/out/target/product/shamu
export ANDROID_PRODUCT_OUT_BIN=/Volumes/android/android7.1.1/out/host/darwin-x86/bin
export PATH=$PATH:$ANDROID_PRODUCT_OUT_BIN:$ANDROID_PRODUCT_OUT:$ANDROID_BUILD_TOP
emulator
-system /Volumes/android/android7.1.1/out/target/product/shamu/system.img
-data /Volumes/android/android7.1.1/out/target/product/shamu/userdata.img
-ramdisk /Volumes/android/android7.1.1/out/target/product/shamu/ramdisk.img
下载源码遇到的问题一:
这个error信息忘了详细记录了,就是某个./repo/projects/.............下面报错了,把报错的文件夹删掉,repo sync
error:
………………………………………………………………………...
Traceback (most recent call last):
File "/Volumes/aosp/android-6.0.1/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
…………………………….
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd4 in position 578: ordinal not in range(128)
解决办法:根据error的提示,删除./repo/projects/...相应下的git就行了,然后再repo sync
编译源码遇到的问题二:
build/core/combo/mac_version.mk:39: * Can not find SDK 10.12 at /Developer/SDKs/MacOSX10.6.sdk
build/core/combo/mac_version.mk:40: *****************************************************
build/core/combo/mac_version.mk:41: *** Stop.. Stop.
配置mac_sdk_versions_supported里添加10.12
编译源码遇到的问题三:
system/core/libcutils/threads.c:38:10: error: 'syscall' is deprecated: first deprecated in OS X 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations]
return syscall(SYS_thread_selfid);
^
host C: libcutils <= system/core/libcutils/iosched_policy.c
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:733:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
MacOSX-SDKs下载地址:https://github.com/phracker/MacOSX-SDKs
删除10.12,下载MacOSX10.11.sdk,解压拷贝到/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
然后确保AOSP源码下build/core/combo/mac_version.mk文件中
mac_sdk_versions_supported := 10.9 10.10 10.11
后面不要写10.12。
编译源码遇到的问题四:
找不到com.sun.javadoc.ClassDoc
external/doclava/src/com/google/doclava/ClassInfo.java:20:
error: package com.sun.javadoc does not exist import com.sun.javadoc.ClassDoc;external/doclava/src/com/google/doclava/apicheck/XmlApiFile.java:80:
error: cannot find symbol ClassDoc classDoc = null; ^
symbol: class ClassDoc location: class XmlApiFile Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 163 errors
make: *** [out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib.jar] Error 41
在bash_profile里添加
export ANDROID_JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
nothing matches overlay file notification_bg_normal_pressed.9.png, for flavor hdpi-v19
nothing matches overlay file notification_bg_normal_pressed.9.png, for flavor xhdpi-v19
nothing matches overlay file notification_bg_normal_pressed.9.png, for flavor xxhdpi-v4
nothing matches overlay file notification_bg_normal_pressed.9.png, for flavor xxhdpi-v19
[ 99% 27238/27420] Compiling SDK Stubs...tubs_current_intermediates/classes.jar
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[ 99% 27413/27420] host Java: ahat-tes...RIES/ahat-tests_intermediates/classes)
注: art/tools/ahat/test/SortTest.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[100% 27420/27420] Checking build with...sts_intermediates/jack.check.timestamp