最近想學習一下安卓,把學習過程中遇到的問題記錄一下。
開發(fā)環(huán)境
用的MAC本做的開發(fā),開發(fā)Android應用,必然少不了java的JDK.首先需要eclipse的開發(fā)環(huán)境,然后需要Android的SDK,以及ADT將這些東西連接起來,版本要匹配。
Mac新建應用出錯
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'test'.
java.lang.NullPointerException
原因:JDK版本過高,ADT不能正常使用
$ADT_DIR/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini ,然后在vmargs行之前,加入如下兩行配置
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
I confirm that the ADT bundle does not work with the Oracle Java 7 SE JDK, failing with an NPE in the Android Application Project wizard.
Here's a workaround that lets you keep Java 7 as the default but run ADT with Java 6 when you have both installed. Bring up $ADT_DIR/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini in an editor.? Before the -vmargs line, insert these two lines:
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
eclipse打包時出錯 Export aborted because fatal lint errors we
忽略出錯內容即可
右鍵工程,選擇Properties->Android Lint Preference,在對話框右邊有Configure Workspace Settings,點擊后,在出現(xiàn)的
對話框中取消Run full error check when exporting app and abort if fatal errors
are found 的選項,再重新打包
eclipse打包步驟
右鍵工程,Android Tools - > Export Android Application
有keyStore選擇原有的,輸入密碼,沒有就新建一個
keyStore是安卓應用的唯一標識,如果兩個應用用同一個keyStore簽名則為同一個應用,
安裝時會進行升級安裝
Alias? ? hello (證書名字)
Password 1234
Confirm 1234 (確認密碼)
Validity 50 (有效時間/年)
First and Last Name?
Organizational Unit
Organization
City or Locality
State or Province Beijing
Country Code ?CN(國家編碼)