Skip to content

Instantly share code, notes, and snippets.

@danhantao
Last active August 29, 2015 14:03
Show Gist options
  • Save danhantao/e748faa3c0eab637ea62 to your computer and use it in GitHub Desktop.
Save danhantao/e748faa3c0eab637ea62 to your computer and use it in GitHub Desktop.
aar apklib maven android plugin
1.结论:无法使用apklib
apklib生成的R文件是final的,能打包成apklib。但是在drive-android里面引入的时候,报错依然说不是常量。
aar生成的R文件非final的,生成aar的时候就就提示,无法通过。
2.无法使用roboguice里面的一些注解。
这个可以用tag标签来解决。
3.Also, add this to the android-maven-plugin's <configuration> tag:
<attachSources>true</attachSources>
这个可以解决找不到资源文件。无法解决。
如果layout目录下有冲突,那么导致很多文件无法合并。
4.aar下的libs目录下文件无法打包到apk,apklib不存在这样的问题。
打包apklib或者apk时,如果目录下有.so文件,需要制定平台,才能将so文件打入进去。
<ndkArchitecture>x86 armeabi mips armeabi-v7a</ndkArchitecture>
5.so文件可以通过依赖的方式加入进去。
可以解决
3.9.0-rc.2 complete support for AAR format?
https://github.com/jayway/maven-android-plugin/issues/402
http://stackoverflow.com/questions/10900017/android-maven-plugin-and-resource-filtering
http://code.google.com/p/maven-android-plugin/issues/detail?id=194
https://code.google.com/p/maven-android-plugin/issues/detail?id=96
https://code.google.com/p/maven-android-plugin/wiki/ApkSourcesDependency
http://stackoverflow.com/questions/8823392/android-maven-plugin-apklib-mojo-doesnt-include-compiled-r-in-resulting-apklib
1、打包:mvn clean package
2、打包并安装到本地仓库:mvn clean install
3、利用maven下载源代码:mvn dependency:sources
4、构建成eclipse工程:mvn eclipse:eclipse
5、清除eclipse结构:mvn eclipse:clean
6、查看maven的依赖树结构:mvn dependency:tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment