【问题标题】:maven android plugin with android support library v7带有android支持库v7的maven android插件
【发布时间】:2013-10-19 06:45:02
【问题描述】:

我使用 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

【问题讨论】:

    标签: java android maven


    【解决方案1】:

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

    • 我这样做了: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>
      

    【讨论】:

      【解决方案2】:

      试试这个:

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

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

      【讨论】:

        猜你喜欢
        • 2015-10-04
        • 1970-01-01
        • 2014-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-20
        相关资源
        最近更新 更多