掛載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
_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