android build on windows

28
Android Build CS Team 陳陳陳 P76034305

Upload: addweup

Post on 14-Apr-2017

975 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Android build on windows

Android BuildCS Team 陳顥文 P76034305

Page 2: Android build on windows

Build Android on Windows• 3-Way try to do that.

1.Virtual Machine install Linux(like Ubuntu, or Customer distribution http://nathanpfry.com/builduntu-virtual-machine-android-rom-compiling/) Which install VirtualBox and run upside link provide image to build.

2.Using Cygwin, But will encounter a lot of problem Install all package spend lot of time. But I try this way to build on Windows 8.1 x64 platform.

3. Using XDA Cygwin + Android Kitchen http://forum.xda-developers.com/showthread.php?t=2195858 https://github.com/dsixda/Android-Kitchen

Page 3: Android build on windows

Install Cygwin• Install JDK before install Cygwin• Download from Oracle site. At least Version 6+

• Download Cygwin from: http://cygwin.com/install.html• Install, Choose JP mirror site will get better download speed.• Don’t install all package, Exclude Graphic, KDE, Gnome, X11, Game…

etc. Some thing you won’t need in build.• Minimal install package didn’t try.• Install all package will cost around 60GB Disk space.

Page 4: Android build on windows

Install JDK 6• Download Windows JDK x64 from Oracle Website.• http://

www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html

• Remove current JDK you install.(If newer than JDK 6) Cause system will automatic setting machine register into newest JDK version.

• Install JDK 6, MAKE SURE INSTALL PATH WITHOUT SPACE. If install in default path like: C:\Program Files\java\jdk_1.6.0_45 When #make clean, #make … you will encounter Java version not corrent.

I’m install in D:\ You also can install in default path, and copy hole JDK to non-spacing path.

Page 5: Android build on windows

Add environment variable• # cd ~• # vi ./.bash_profile• Add

export JAVA_HOME=/cygdrive/D/jdk1.6.0_45 export ANDROID_JAVA_HOME=/cygdrive/D/jdk1.6.0_45 export PATH=$PATH:”/cygdrive/D/jdk1.6.0_45

• Restart your Cygwin terminal.

• Check JDK # java –version # javac –version

Page 6: Android build on windows

Get repo in Gygwin• Once you install Gygwin completed. You need install Google repo first.• Google repo help you get Android Source code from Google git site.

• # cd ~ && mkdir bin• # curl https://storage.googleapis.com/git-repo-downloads/repo >

~/bin/repo• # chmod a+x ~/bin/repo• # mkdir android && cd android• # ~/bin/repo init –u -u

https://android.googlesource.com/platform/manifest -b android-4.4_r1• # repo sync

Page 7: Android build on windows

Get other necessary file you need.• # cd ~ && mkdir android_pack_download• # wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-

krt16m-bf9b8548.tgz• # wget https://dl.google.com/dl/android/aosp/lge-hammerhead-

krt16m-0efa9c33.tgz• # wget https://

dl.google.com/dl/android/aosp/qcom-hammerhead-krt16m-53cf1896.tgz

• # for f in *.tgz; do tar xzf $f; done• # for extractor_script in *.sh; do bash $extractor_script; done• # cp –r vendor ~/android/

Page 8: Android build on windows

Get other necessary file you need.• # wget https://dl.google.com/dl/android/aosp/hammerhead-krt16m-

factory-bd9c39de.tgz• # tar xzf hammerhead-krt16m-factory-bd9c39de.tgz• # cd hammerhead-krt16m• # unzip image-hammerhead-krt16m.zip

• Get simg2img_win• # wget https://

github.com/KinglyWayne/simg2img_win/blob/master/simg2img.exe• # chmod a+x simg2img.exe• #./simg2img system.img system.img.raw

Page 9: Android build on windows

Get other necessary file you need.• Using “Disk internals Linux Reader” to mount image.• http://www.diskinternals.com/linux-reader/

• Click Right-up coroner “Drives” -> “Raw Disk Images” -> Select your system.img.raw to mount.

• Copy missing file from NCKU Android Class slide said.

• Copy those file to ~/android/vendor/lge/hammerhead/proprietary/ ~/android/vendor/qcom/hammerhead/proprietary/

Page 10: Android build on windows
Page 11: Android build on windows
Page 12: Android build on windows
Page 13: Android build on windows

Missing from vendor/lge/hammerhead:

• /system/app/OmaDmclient.apk• /system/etc/DxHDCP.cfg• /system/vendor/bin/vss_init• /system/vendor/firmware/discretix/dxhdcp2.b00• /system/vendor/firmware/discretix/dxhdcp2.b01• /system/vendor/firmware/discretix/dxhdcp2.b02• /system/vendor/firmware/discretix/dxhdcp2.b03• /system/vendor/firmware/discretix/dxhdcp2.mdt• /system/vendor/lib/libDxHdcp.so• /system/vendor/lib/libvdmengine.so

• /system/vendor/lib/libvdmfumo.so• /system/vendor/lib/libvss_common_core.so• /system/vendor/lib/libvss_common_idl.so• /system/vendor/lib/libvss_common_iface.so• /system/vendor/lib/libvss_nv_core.so• /system/vendor/lib/libvss_nv_idl.so• /system/vendor/lib/libvss_nv_iface.so

Page 14: Android build on windows

Missing from vendor/qcom/hammerhead:

• /system/app/shutdownlistener.apk• /system/app/TimeService.apk

Page 15: Android build on windows

Change device-partial.mk • # cd ~/android• # rm -r -f vendor/lge/hammerhead vendor/qcom/hammerhead• # git clone

https://github.com/jamesonwilliams/vendor_lge_hammerhead.git vendor/lge/hammerhead

• # git clone https://github.com/jamesonwilliams/vendor_qcom_hammerhead.git vendor/qcom/hammerhead

• # sed -i '/^PRODUCT_RESTRICT_VENDOR_FILES/s/true/false/' device/lge/hammerhead/full_hammerhead.mk #this command will failed, need modify by manually.

Page 16: Android build on windows

Get kernel• # git clone https://android.googlesource.com/kernel/msm.git -b

android-msm-hammerhead-3.4-kk-r1 kernel• # sed -i '48,51d' kernel/AndroidKernel.mk• # sed -i '47s,$, zImage-dtb,' kernel/AndroidKernel.mk

Page 17: Android build on windows

Try build in Gygwin• # . build/envsetup.sh• # lunch aosp_hammerhead-userdebug #error.• # make clean• # make updatepackage # -j10

Page 18: Android build on windows

Add leak windows_sdk_whitelist.mk• Copy

https://code.google.com/p/android-source-browsing/source/browse/build/windows_sdk_whitelist.mk?repo=platform--development&r=645a29c837ca42016f20d1949127b58c6a105d31

• Name “windows_sdk_whitelist.mk”, copy to ~/android/build/core/• Edit ~/android/build/core/main.mk• Line 431ifeq ($(SDK_ONLY),true)#include $(TOPDIR)sdk/build/windows_sdk_whitelist.mk#include $(TOPDIR)development/build/windows_sdk_whitelist.mkinclude build/core/windows_sdk_whitelist.mkinclude build/core/windows_sdk_whitelist.mk

Page 19: Android build on windows

Problem can’t solve 1$ lunch aosp_hammerhead-userdebugbuild/core/product_config.mk:227: *** _nic.PRODUCTS.[[device/lge/hammerhead/aosp_hammerhead.mk]]: "frameworks/native/build/phon e-xhdpi-2048-dalvik-heap.mk" does not exist. Stop.

** Don't have a product spec for: 'aosp_hammerhead'** Do you have the right repo manifest?

• 2015/03/18 Solve by re-sync repo again.

Page 20: Android build on windows

Problem can’t solve 2$ make updatepackage –j8…find: ‘../../../libcore/dex/src/main/java’: No such file or directoryincluding dalvik/libdex/Android.mk ...…including development/apps/BuildWidget/Android.mk ...build/core/java.mk:23: *** development/apps/BuildWidget: Invalid LOCAL_SDK_VERSION 'current' Choices are: . Stop.

• 2015/03/18 Solve by re-sync repo again.

Page 21: Android build on windows

Problem can’t solve 3$ make updatepackage –j8…including system/extras/ext4_utils/Android.mk ...PRODUCT_COPY_FILES device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml ignored.make: *** No rule to make target 'out/host/windows-x86/bin/mkbootimg.exe', needed by 'out/target/product/hammerhead/boot.img'. Stop.

http://forum.xda-developers.com/android/software/experiment-building-cm11-cygwin-t2858560Download mkbootimg.exe to solve.

Page 22: Android build on windows

Problem can’t solve 4• make: *** No rule to make target 'out/host/windows-x86/bin/acp',

needed by 'out/target/product/hammerhead/kernel'. Stop.

Page 23: Android build on windows

Build Android on Ubuntu• Encounter some problem:

1. Leak libz.so.1prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

make: *** [out/host/linux-x86/obj/EXECUTABLES/mkbootimg_intermediates/mkbootimg.o] Error 1

• Soultion:

# sudo apt-get install lib32z1

Note detail @ my blog: http://www.ntex.tw/wordpresas/2175.html

Page 24: Android build on windows

Build Android on Ubuntu2. Leak “flex”/bin/bash: flex: command not found make: *** [out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_scan.cpp] Error 127

Solution:# sudo apt-get install flex

Note detail @ my blog: http://www.ntex.tw/wordpress/2180.html

• Useful website: http://nosemaj.org/howto-build-android-kitkat-nexus-5

Page 25: Android build on windows

App share list• 愛挖寶-股市 app• RD Client-微軟官方 RDP APP• Real Racing 3- EA賽車遊戲• 生活行-工具好幫手• Spotyify-聽音樂• ES檔案瀏覽器-檔案總管• EVERNOTE-筆記軟體• ONENOTE-筆記軟體• BETWEEN-情侶 APP

• LINE-通訊軟體• FACEBOOK-通訊軟體• beetalk-通訊軟體• 微信 -通訊軟體• 1010!-熱門遊戲• 神魔之塔 -熱門遊戲• 知識王 -熱門遊戲• 台灣蘋果日報 -新聞 APP• 安兔兔評測 -跑分軟體• ezETC-( ETC餘額查詢 , 計程試算 , 即時路況 )

• CYTUS 熱門遊戲• Dropbox 雲端儲存• QRcode scanner• pixiv 圖片瀏覽• 3G watchdog 網路流量監控• office mobile 微軟 office編輯軟體• MetaMoJi Note 手寫筆記• MoPTT 手機板 PTT• TuneIn Radio 網路電台• Camera FV-5 拍照軟體• MX Player 影片播放

Page 26: Android build on windows

systrace• Find which tags can test performance

gfx – Graphics wm - Window Manager am - Activity Manager res - Resource Loading dalvik - Dalvik VM sched - CPU Scheduling freq - CPU Frequency membus - Memory Bus Utilization idle - CPU Idle disk - Disk input and output load - CPU Load

Page 27: Android build on windows
Page 28: Android build on windows

About• This slide build by Nathaniel Chen• 2015/03/19 1522• [email protected]• http://www.ntex.tw/wordpress