編輯:關於Android編程
平台:
Wind7_64 + Ubuntu12_04_64 + VMware
這裡以Android5.0為例:
Android5.0 可以到這裡下載:
115網盤禮包碼:5lbd7crtk1wz
http://115.com/lb/5lbd7crtk1wz
Linux_source_goldfish 可以到這裡下載:
115網盤禮包碼:5lbd76rru5or
http://115.com/lb/5lbd76rru5or
Android5.0的編譯可以參考:
遇到的問題
需要使用openjdk7
apt-get install openjdk-7-jdk apt-get install openjdk-7-jre
編譯:
root@ubuntu:~/work/android/android5/android-5.0# . build/envsetup.sh including device/moto/shamu/vendorsetup.sh including device/samsung/manta/vendorsetup.sh including device/generic/mini-emulator-x86/vendorsetup.sh including device/generic/mini-emulator-arm64/vendorsetup.sh including device/generic/mini-emulator-mips/vendorsetup.sh including device/generic/mini-emulator-x86_64/vendorsetup.sh including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh including device/lge/mako/vendorsetup.sh including device/lge/hammerhead/vendorsetup.sh including device/asus/tilapia/vendorsetup.sh including device/asus/deb/vendorsetup.sh including device/asus/grouper/vendorsetup.sh including device/asus/flo/vendorsetup.sh including device/asus/fugu/vendorsetup.sh including sdk/bash_completion/adb.bash root@ubuntu:~/work/android/android5/android-5.0# choosecombo Build type choices are: 1. release 2. debug Which would you like? [1] 1 Which product would you like? [full] Variant choices are: 1. user 2. userdebug 3. eng Which would you like? [eng] ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=5.0 TARGET_PRODUCT=full TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a TARGET_CPU_VARIANT=generic TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= HOST_ARCH=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-3.5.0-23-generic-x86_64-with-Ubuntu-12.04-precise HOST_BUILD_TYPE=release BUILD_ID=LRX21M OUT_DIR=out ============================================ root@ubuntu:~/work/android/android5/android-5.0# make
編譯完成後,設置工具鏈路徑,為編譯內核方便:
export PATH=$PATH:/root/work/android/android-5.0/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
編譯內核:
下載內核後,解壓
root@ubuntu:~/work/android/android5/goldfish# git branch -a master remotes/origin/HEAD -> origin/master remotes/origin/android-3.10 remotes/origin/android-3.4 remotes/origin/android-goldfish-2.6.29 remotes/origin/android-goldfish-3.10 remotes/origin/android-goldfish-3.4 remotes/origin/linux-goldfish-3.0-wip remotes/origin/master
由於Android5.0的模擬器使用的內核是3.4(可以用模擬器自帶的內核啟動一個模擬器,然後看一下內核版本 cat /proc/version ), 所以我們也是用3.4:
root@ubuntu:~/work/android/android5/goldfish# git checkout remotes/origin/android-goldfish-3.4 -b linux-3.4
然後修改Makefile
ARCH ?= arm CROSS_COMPILE ?= arm-eabi-
配置內核
root@ubuntu:~/work/android/android5/goldfish# make goldfish_armv7_defconfig
注意:這個默認的內核並沒有配置模塊加載功能,需要執行make menuconfig設置,否則無法編譯和加載內核模塊
編譯內核
make zImage -j2
用我們編出的內核啟動模擬器:
root@ubuntu:~/work/android/android5/android-5.0# emulator64-arm -kernel ../goldfish/arch/arm/boot/zImage
上節中我們是手動拼接xml文件,但是上節中那樣的做法會有一個問題,比如: //插入消息的內容sBuffer.append(); sBuffer.append(s
在Android群裡,經常會有人問我,Android Log是怎麼用的,今天我就把從網上以及SDK裡東拼西湊過來,讓大家先一睹為快,希望對大家入門Android Log有
在web頁面中,有a標簽的超鏈接實現跳轉,同樣在Android當中,用TextView控件來顯示文字,實現它的事件來跳轉。用過微博Android手機端的朋友的都知道微博正
微信紅包自打出世以來就極其受歡迎,搶紅包插件可謂紅極一時.今天,我們重新談談搶紅包插件的哪些事兒.本質上,搶紅包插件的原理不難理解,其過程就是在收到紅包時,自動模擬點擊.