eclipse ant 打包

参考帖子:http://www.cnblogs.com/yaozhongxiao/p/3523061.html
http://bbs.csdn.net/topics/380199724
项目引入多个library工程和ndk工程
1.在每个library路径下输入命令:
android update lib-project -p ./
会增加:local.properties和build.xml文件表示正确执行
在build.xml中增加
<property name="aapt.ignore.assets" value="!.svn:!.git:\x3Cdir\x3E_*:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~:crunch" />
不然打包是会报错can't find referenced class
2.在主工程路径下输入
android update project --name com.xiaoji.emulator --target 14 --path ./  --subprojects 
会增加:local.properties和build.xml文件表示正确执行
local.properties修改,如果项目有ndk工程需要再配置ndk路径,如果没有ndk工程可以不加
ndk.dir= D:\\android-ndk -r9d-windows-x86_64\\android-ndk-r9d
3.配置打包时key密码ant.properties
key.store= D:/xxx.keystore
key.store.password= xxxx
key.alias= xxxx
key.alias.password= xxx
4.主工程目录下ant debug生成未签名的包
ant release生成签名的包
生成的包会放在bin目录下


可能会出现的错误:
1.报错:找不到符号
解决办法:多个library可能存在相同jar包,删除相同的,应用同一份jar包
http://cst.is-programmer.com/posts/23793.html
2.报错:
[proguard] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
[proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
解决方案:
proguard中增加:
- dontnote **ILicensingService
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
参考: http://stackoverflow.com/questions/14461024/unknown-classes-ilicensingservice-notes-when-obfuscating-android-project
3.
错误:Cannot run program "${ndk.dir}\ndk-build"
说明需要重新编译so,如果需要编译so就增加文件,不需要就直接删除
编译需在Cygwin环境下
解决方案:
在ndk工程下增加:custom_rules.xml
内容:
< project name = "PPSSPP" default = "help" >
    < property name = "ndkbuildopt" value = "" />
    < target name = "-pre-build" >
        < exec executable = "${ndk.dir}/ndk-build.cmd" failonerror = "true" >
            < arg line = "-j4 ${ndkbuildopt}" />
            < env key = "NDK_MODULE_PATH" path = "..:../native/ext" />
        </ exec >
    </ target >
    < target name = "clean" depends = "android_rules.clean" >
        < exec executable = "${ndk.dir}/ndk-build.cmd" failonerror = "true" >
            < arg value = "clean" />
            < env key = "NDK_MODULE_PATH" path = "..:../native/ext" />
        </ exec >
    </ target >
</ project >
其中   < exec  executable  =  "${ndk.dir}/ndk-build.cmd"   failonerror =  "true"  >
"${ndk.dir}/ndk-build.cmd"视情况是否增加.cmd,可去ndk安装目录下查看有ndk-build.cmd和ndk-build两个文件
参考:
http://stackoverflow.com/questions/7432449/android-ndk-build-with-ant-script
不需要重新编译so的话就不需要这个文件custom_rules.xml
4.错误: Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
5. 错误:can't find referenced class
http://bbs.csdn.net/topics/380199724
1) 找到sdk 》tools》ant》build.xml文件
找到如下一行,value设置为crunch 即可
<property name="aapt.ignore.assets" value="crunch" />
2) <property name="aapt.ignore.assets" value="!.svn:!.git:\x3Cdir\x3E_*:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~:crunch" />
如果增加还是有错误,请查看各个library中指定 proguard.config= proguard.cfg是否正确,删除这个指定,只留主工程的 proguard.config
6:打包出现java.lang.OutOfMemoryError: GC overhead limit exceeded
sdk\build-tools\22.0.1\dx.bat  set defaultXmx=-Xmx2048M加大


你可能感兴趣的:(eclipse,android,apk,ant,打包)