eclipse android maven插件,添加Eclipse“Android Library”项目并通过Maven构建
1) a reliable way to see if a certain class/jar/whatever was packaged up into my apk, as the steps to get to this point in my app are long and complicated right now
從命令行構建項目(即mvn clean install),maven將在構建的每個階段/目標期間輸出詳細日志,在dex目標中,您可以看到如下內容:
[INFO] — android-maven-plugin:3.1.1:dex (default-dex) @ myproject —
[INFO] C:\Program Files\Java\jdk1.6.0_21\jre\bin\java [-Xmx1024M, -jar, C:\Progr
am Files\Android\android-sdk-r16\platform-tools\lib\dx.jar, –dex, –output=C:\workspace\myproject\target\classes.dex, C:\workspace\myproject\target\classes, C:\maven\repository\cocos2d_android\cocos2d_android\1.0.0-SNAPSHOT\cocos2d_android-1.0.0-SNAPSHOT.apklib, C:\maven\repository\com\google\code\gson\gson\1.7.1\gson-1.7.1.jar, … …]
Android庫項目實際上是作為cocos2d_android-1.0.0-SNAPSHOT.apklib與其他常規jar庫存檔一起使用.
2) Something in the Manifest or pom.xml for either the main app or the library project seems to be missing – something needed to signal to Maven to pick up this other project – what is it?
它是ApkLib,它只是Android庫項目的zip存檔(src /,res /,AndroidManifest.xml等).我們通常使用依賴的Android項目創建/實現我們自己的Android庫項目作為多模塊maven項目,但是,如果您需要參考由其他開發人員編寫的Android庫項目,則不需要這樣做.感謝開發者,android-maven-plugin已經支持非Maven Android Library項目,請查看Compatible with non-Maven Android Library Projects:
The generated .apklib file will have the layout of a standard Android/Eclipse library project. This means that regardless of your Maven layout, the layout inside the .apklib file will be that source code is in “src/” instead of “src/main/java/”, but still interpreted correctly when used in an Android/Maven application project. This is to be compatible with non-Maven developers’ library projects, which is important to grow the Android developer community.
Use other non-Maven developers’ libraries
It also means we can take any external Android library project zip file (from non-Maven developers) and do mvn install:install-file … on it and simply start using it as a dependency.
Share your .apklib with non-Maven developers
To share your .apklib file with a non-Maven developer, they will probably feel more comfortable if you rename it to .zip. They can then simply unpack it in a directory and use it from there.
所以解決方法是:
>將您的Android庫項目正確打包到zip存檔,然后將其重命名為something.apklib.
>使用mvn install:install-file將something.apklib安裝到Maven本地存儲庫中.
>在任何需要庫依賴的Android項目中,只需使用:
cocos2d_android
cocos2d_android
1.0.0-SNAPSHOT
apklib
在android-maven-plugin網站上查看Samples以了解如何正確使用apklib.
總結
以上是生活随笔為你收集整理的eclipse android maven插件,添加Eclipse“Android Library”项目并通过Maven构建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 文件存储 集合,Andr
- 下一篇: c语言如果读不到数据就跳过,4,VS常见