简体   繁体   English

使用带有内部库的Maven构建android项目

[英]Build android project using maven with internal libraries

I have an android library that uses native android libraries and and internal libraries. 我有一个使用本机android库和内部库的android库。 If I execute from eclipse like an android application all works but if I try to compile using maven (It is a maven project using eclipse and maven-android-plugin) it fails: 如果我像Android应用程序一样从eclipse执行所有工作,但是如果我尝试使用maven进行编译(这是一个使用eclipse和maven-android-plugin的maven项目),它将失败:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project devices: Compilation failure: Compilation failure: [ERROR] /C:/android/device/epayment/gateway/PAX.java:[34,23] C:\\android\\device\\epayment\\gateway\\PAX.java:34: package com.pax.poslink does not exist [错误]无法在项目设备上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile(默认编译):编译失败:编译失败:[ERROR] / C:/ android / device / epayment / gateway / PAX.java:[34,23] C:\\ android \\ device \\ epayment \\ gateway \\ PAX.java:34:包com.pax.poslink不存在

My pom.xml contains: 我的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>

It seems that the tag nativeLibrariesDirectory doesn't works for me. 标记nativeLibrariesDirectory似乎不适用于我。

What am I doing wrong? 我究竟做错了什么?

Thanks for the help 谢谢您的帮助

您必须声明对库的依赖关系并将其托管在Maven存储库(而不是lib文件夹)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM