最近想学习一下安卓,把学习过程中遇到的问题记录一下。
开发环境
用的MAC本做的开发,开发Android应用,必然少不了java的JDK.首先需要eclipse的开发环境,然后需要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,点击后,在出现的
对话框中取消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(国家编码)