以下这个问题 缠绕了 我很长时间 google 上搜了半天也没有相关的说明或者很乱!
环境:eclipse 3.6,ADT-14.0.0.zip,maven 2.0.11,maven-android-plugin 2.8.4,M2eclipse
pom.xml 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lekan</groupId>
<artifactId>Activity_Test</artifactId>
<packaging>apk</packaging>
<version>0.1-SNAPSHOT</version>
<name>Android_Test</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android_11</artifactId>
<version>${android-version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>2.8.4</version>
<configuration>
<sdk>
<path>${sdk.path}</path>
<platform>${android-platform}</platform>
</sdk>
<emulator>
<avd>${android-emulator}</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<properties>
<sdk.path>c:\android_sdk</sdk.path>
<android-platform>11</android-platform>
<android-version>3.0</android-version>
<android-emulator>android-11</android-emulator>
</properties>
</project>
使用 mvn package 报错
Cannot find required method com.android.sdklib.build.ApkBuilder.addNativeLibraries(java.io.File, java.lang.String)
Cannot find required method
java.lang.NoSuchMethodException: com.android.sdklib.build.ApkBuilder.addNativeLibraries(java.io.File, java.lang.String)
at java.lang.Class.getMethod(Class.java:1605)
at com.jayway.maven.plugins.android.phase09package.ApkBuilder.initialize(ApkBuilder.java:102)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.initializeAPKBuilder(ApkMojo.java:294)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:162)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:144)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
折腾了很久终于找到关键所在 我将maven 升级到 maven 3.0.3 在将android-maven-plugin 升级到 3.0.0
设置 eclipse windows-preferences-maven-installations 添加 本地安装的maven3.0目录
修改后的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lekan</groupId>
<artifactId>activity_test</artifactId>
<packaging>apk</packaging>
<version>0.1-SNAPSHOT</version>
<name>android_test</name>
<properties>
<android-platform>7</android-platform>
<maven-android-plugin-version>3.0.0</maven-android-plugin-version>
<android-version>2.1</android-version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android_7</artifactId>
<version>${android-version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${maven-android-plugin-version}</version>
<extensions>true</extensions>
<configuration>
<sdk>
<path>${env.ANDROID_SDK_HOME}</path>
<platform>${android-platform}</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
当让你也可以将签名 流程 配置到 pom里!
在解决这个问题的同时搜索到不少好的文章以下共享链接:
http://www.cnblogs.com/Pickuper/archive/2011/06/14/2078969.html
http://www.blogjava.net/askcuix/archive/2011/03/07/345897.html
http://www.cnblogs.com/feisky/archive/2011/03/13/1650076.html
http://code.google.com/p/maven-android-plugin/issues/detail?id=209#c0
http://code.google.com/p/maven-android-plugin/issues/detail?id=210
http://www.cnblogs.com/abob/archive/2010/06/24/1764521.html
最后有什么不明白的 可以留言!
分享到:
相关推荐
exec-maven-plugin是Maven生态系统中的一个插件,它允许用户在Maven构建过程中执行外部命令或脚本。这使得Maven项目可以集成更多的自定义操作,比如运行特定的脚本、调用系统命令等。本文将详细介绍exec-maven-...
maven3-plugin-3.0.1-sources.jar
apply plugin: 'com.github.dcendents.android-maven' android { // Android相关配置 } group = 'your.group.id' version = '1.0.0' artifactId = 'your.artifact.id' ``` 3. 配置发布到Maven仓库的相关...
`maven-compiler-plugin-3.8.0-source-release` 版本是 Maven 编译插件的一个特定版本,该版本包含了对 Maven 3.x 系列的支持。这个插件的主要任务包括: 1. **源代码编译**:默认使用 JDK 的 `javac` 编译器进行 ...
maven-jar-plugin-3.1.1.jar
maven-deploy-plugin-2.8.2.jar
maven-site-plugin-3.3.jar
maven-surefire-plugin-2.22.1.jar
maven3-plugin-3.0.0-1-sources.jar
maven-antrun-plugin-3.0.0.jar
maven-clean-plugin-3.1.0.jar
Maven 使用 tomcat8-maven-plugin 插件 Maven 是一个流行的构建自动化工具,它可以帮助开发者自动完成项目的编译、测试、打包、部署等任务。 Tomcat 是一个流行的 Web 服务器,Maven 提供了一个插件 tomcat8-maven-...
maven-install-plugin-2.4.jar
maven-jxr-plugin-2.1.jar
maven-deploy-plugin-2.7.jar
eclipse-maven3-plugin.7z 解压缩到 plugins 目录下 3. 在 links 目录下创建一个maven.link(名字可以随便取,但必须是.link结尾的文件)文件 打开并输入:path= D:/Development/eclipse-JavaEE/eclipse/plugins...
maven-assembly-plugin-2.2-beta-5.jar
maven-resources-plugin-2.4.1.jar
本文将详细讨论如何将Jetty与Maven进行集成,并介绍关键的`maven-jetty-plugin`插件及其不同版本。 1. Maven与Jetty集成的意义: Maven通过其强大的依赖管理功能,使得项目构建变得简单和规范。而Jetty作为轻量级...
maven-antrun-plugin-1.3.jar maven-archiver-2.2.jar maven-artifact-3.2.1-sources.jar maven-assembly-plugin-2.2-beta-5.jar maven-bundle-plugin-1.0.0.jar maven-clean-plugin-2.4.1.jar maven-clean-plugin-...