我有一个使用内部库的Maven Android项目。当我运行 maven install 时,所以库不在生成的jar文件中,因此不在apk生成的内部。我正在使用Eclipse与maven和android maven插件v.3.7.0。
我的pom.xml是:
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>../bin/${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>15</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
似乎 nativeLibrariesDirectory 标记对我不起作用。
有什么想法解决这个问题吗? 感谢
答案 0 :(得分:1)
以下是如何在apk中包含本机库:
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifest>
<debuggable>true</debuggable>
</manifest>
<!-- Where the native files are located; in the future we should use src/main/libs -->
<nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 1 :(得分:0)
Android for Maven Eclipse项目尚不支持本机库。如果您希望看到此支持,请发送pull request。