设为首页 加入收藏

TOP

Ant 命令行编译Android项目(二)
2015-07-16 12:57:05 来源: 作者: 【 】 浏览:17
Tags:Ant 命令 编译 Android 项目
? ? ? ? ? ? ? metadatafile="${emma.coverage.absolute.file}">
? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ?
? ? ? ? ? ?


? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? Creating library output jar file...
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? Custom jar packaging exclusion: ${android.package.excludes}
? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ?


? ? ? ? ? ? ? ? ? ?


? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? includes="**/*.class"
? ? ? ? ? ? ? ? ? ? ? ? ? ? excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/BuildConfig.class"/>
? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?
? ? ? ? ? ?


? ? ? ?
? ?


?


ant.properties的例子, 和上面的xml是对应的


?


key.store=D:/workAndroid/files/android_key.store
key.alias=alia
key.store.password=111111
key.alias.password=111111
java.encoding=UTF-8
java.target=7
java.source=7


?


?


在生成的apk中使用版本号文件名, 而不是用默认的 xxx-release.apk


http://jeffreysambells.com/2013/02/14/build-your-android-apk-with-the-manifest-version-number


?


? ? ? ? ? ? depends="rename-release-with-version-number,android_rules.-set-release-mode">
? ? ? ?
? ?


? ?
? ? ? ?
? ? ? ?
? ? ? ? ? ? ? ? ? ? location="${out.absolute.dir}/${ant.project.name}-${themanifest.manifest.android:versionName}-release-unsigned.apk" />
? ? ? ? ? ? ? ? ? ? location="${out.absolute.dir}/${ant.project.name}-${themanifest.manifest.android:versionName}-release.apk" />
? ?


?


?


The -set-release-mode target overrides the same target in ${sdk.dir}/tools/ant/build.xml where the out.final.file file name is originally defined. To add the version number, I override -set-release-mode by calling my rename-release-with-version-number target in the dependencies and then calling the original android_rules.-set-release-mode to finish any other setup there.


The rename-release-with-version-number target simply reads in the manifest and adds the version number to both out.final.file and out.packaged.file.


Now the build APK is ProjectName-version-release.apk and it’s automatically used by the rest of the ant build process without clumsy file renaming.


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇《UNIX环境高级编程》文件共享及f.. 下一篇Android将图片保存到相册并及时看..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: