1.安装m2eclipse-android-integration https://svn./a/eclipselabs.org/m2eclipse-android-integration/updates/m2eclipse-android-integration/ 其实这个不需要安,不过下面的是必须要安装的。 安装maven-android-sdk-deployer https://github.com/mosabua/maven-android-sdk-deployer 下载完后,执行:
如果报错,说明sdk没有安装完整(google api等等),要在android sdk manager里面下载完整, 如果运行正常的话,这一步操作就是将sdk的包放入到svn的本地仓库里了。 2.Create Eclipse project If you already have an Android project please make sure you have created a POM for your project using version 3.0.0 or greater of the maven-android-plugin. Then right-click on your project and select Configuration -> Convert to Maven Project. If you are starting with a new project you can use the Maven Android archetypes to create Android projects completely within Eclipse: Create a new Maven Project (File -> New -> Project... then select Maven -> Maven Project). When prompted to Select Archetype click Add Archetype... In the dialog that appears enter "de.akquinet.android.archetypes" for Archetype Group Id. In Archetype Artifact Id enter "android-quickstart". In Archetype Version enter "1.0.8" and continue. When prompted enter your desired project group and artifact ID, version and, optionally, set the "platform" property for the Android version (defaults to '10'). Click Finish Right-click on new project and select Maven -> Update Project Configuration. 3.Install Android Connector Windows->Preferences->Maven->Discovery->Open Catalog->安装m2e connector for android 4.至此新建的项目应该不会再报错了。 5.配置maven插件,自动打包签名,附上我的完整的pom:
setting.xml
特别提醒: 1.<removeExistingSignatures>true</removeExistingSignatures>这个一定要配上,我之前参考网上的都没有这一项,结果就是签名的apk里面有两个签名,一个是自己的一个是android debug的,so... 2.记住源代码的路径要更改为:src/main/java,否则在package的时候会抱错,并且就算不抱错,打好的包在真机上也运行不了,谨记,为这个事情,我折磨了一整天。 6.配置这这一切,接下来就是爽歪歪的时候了: 进入target目录,看到的mvndemo-1.0.9.apk就是已经签过名的apk,怎么?不相信,自己看看:
看到没?打印出来的信息里,是不是有自己的签名信息。 |
|