android - 带有 android maven 插件的核心库

标签 android maven maven-plugin java

我想在 android 中使用 nativ 库。当我尝试用

mvn clean install 

我得到一个错误

[INFO] If you really intend to build a core library -- which is only
[INFO] appropriate as part of creating a full virtual machine
[INFO] distribution, as opposed to compiling an application -- then use
[INFO] the "--core-library" option to suppress this error message.

如何在 pom.xml 中添加 --core-library 参数?

我的 pom 看起来像

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0

<parent>
    <groupId>com.temp</groupId>
    <artifactId>SipAndroidClient</artifactId>
    <version>0.1</version>
</parent>

<artifactId>android-di</artifactId>
<packaging>apk</packaging>
<name>android-di - Application</name>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.pivotallabs</groupId>
        <artifactId>robolectric</artifactId>
        <version>1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
    </dependency>
    <dependency>
        <groupId>org.roboguice</groupId>
        <artifactId>roboguice</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>de.mindpipe.android</groupId>
        <artifactId>android-logging-log4j</artifactId>
        <version>1.0.3</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.2</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.2</version>
    </dependency>
    <dependency>
        <groupId>javax.sip</groupId>
        <artifactId>jain-sip-api</artifactId>
        <version>1.2.1.4</version>
    </dependency>
    <dependency>
        <groupId>javax.sip</groupId>
        <artifactId>jain-sip-ri</artifactId>
        <version>1.2.167</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                <resourceDirectory>${project.basedir}/res</resourceDirectory>
                <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                <sdk>
                    <platform>10</platform>
                    <path>/home/damian/.android-sdk</path>
                </sdk>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

最佳答案

我相信这就是您要找的http://maven-android-plugin-m2site.googlecode.com/svn/dex-mojo.html

查看 dex 部分,将 CoreLibrary 设置为 true 会将“--core-library”发送到 dex。

关于android - 带有 android maven 插件的核心库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14833015/

相关文章:

java - Maven 无法从 .m2/repository 找到 jar

java - 自动部署到sonatype的oss maven仓库

android - 所有代码都从 Android Studio 中消失了

android - Facebook SDK for Android 对依赖项的重复支持库

android - 虚拟键盘出现倾斜

java - 我如何正确配置maven多模块项目

android - 如何在 WebView 中处理二进制数据响应

maven - wordCount作业在 Spring 批处理中失败

eclipse - 带有 Java Server Faces 1.2 的 Maven Java EE 配置标记

java - Spring Boot 中的阴影 jar