【发布时间】:2014-03-13 10:19:18
【问题描述】:
我有一个 android 库项目。我创建了一个 jar 。现在我将 jar 复制到 android 应用程序中的 libs 文件夹并使用 eclipse 和 ant 构建 apk。 apk 文件正在工作,但是当我尝试使用 maven 构建时,apk 文件无法正常工作。我有这个问题很长时间了。 如果我在 pom 文件中犯了任何错误,你能纠正吗?
android 应用程序的 pom 文件:
<?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.project.servicefoundation</groupId>
<artifactId>projectservicefoundation</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>projectserviceFoundation</name>
<dependencies>
<dependency>
<groupId>com.project.servicefoundation</groupId>
<artifactId>androidsdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>androidsdktests</id>
<phase>test</phase>
<goals>
<goal>
emulator-start
</goal>
<goal>
internal-integration-test
</goal>
</goals>
</execution>
</executions>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6) -->
<platform>19</platform>
</sdk>
<emulator>
<avd>mydevice</avd>
<!-- Wait for emulator starting (3 minutes) -->
<wait>180000</wait>
<options>-no-skin</options>
</emulator>
</configuration>
</plugin>
</plugins>
</build>
</project>
android 库项目的 pom 文件
<?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.project.servicefoundation</groupId>
<artifactId>androidsdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>AndroidSDK</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
android 库项目的名称是androidsdk。
【问题讨论】:
标签: android maven ant apk android-library