4

我使用 maven-android-plugin 构建我的 android 应用程序,它依赖于 android 支持库 v4 和 v7。
由于我没有找到如何从 developer.android.com 下载整个 sdk,我没有使用 maven android deployee 工具来设置 android sdk 的本地存储库。因此我想使用包含在 adt-bundle 中的支持库,以下是我在 pom.xml 中编写依赖项的方式:

        <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7</artifactId>
        <version>18</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/appcompat/libs/android-support-v7-appcompat.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v4</artifactId>
        <version>18</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/appcompat/libs/android-support-v4.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility</artifactId>
        <version>18</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/appcompat.apklib</systemPath>
        <type>apklib</type>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility</artifactId>
        <version>18</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/appcompat/bin/appcompat.jar</systemPath>
    </dependency>

前两个是我一开始写的,但是maven报错了:

No resource found that matches the given name 'Theme.AppCompat.Light'.

然后我添加了第三个。我将 v7 项目压缩并重命名为 .apklib。但它仍然无法正常工作。
最后我添加了最后一个,但它也不起作用。那么如何编写一个正确的 pom 来解决这个问题?我的系统信息:

Apache Maven 3.0.4
Java version: 1.7.0_25, vendor: Oracle Corporation
Android Platform Version:4.3
Android Maven Plugin:3.6.0
4

2 回答 2

0

当我玩这个时,我添加了一个<type>jar</type>和一个<type>apklib</type>。我不记得所有的细节。

  • 我这样做了:https ://stackoverflow.com/a/18796764/1738827
  • 我的 pom 文件有这个:

    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>18.0.0</version>
        <type>apklib</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>18.0.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    
于 2014-01-07T12:08:11.097 回答
0

尝试这个:

 <dependency>
     <groupId>com.android.support</groupId>
     <artifactId>appcompat-v7</artifactId>
     <version>18.0.0</version>
     <type>aar</type>
 </dependency>

我使用了这个并且 Theme.Appcompat.Light 是可见的。

于 2017-01-31T00:20:15.523 回答