2013-10-19 120 views
4

我使用maven-android-plugin来构建我的Android应用程序,这取决于android支持库v4和v7。
由于我没有找到如何从developer.android.com下载整个sdk,我没有使用maven android deployee工具来设置android sdk的本地存储库。因此我想使用包含在adt-束,下面是我写的依赖在我的pom.xml:
maven android插件与android支持库v7

 <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> 

前两个是我在开始写的,但行家提出了一个错误:

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

然后我说第三个。我压缩v7项目并重新命名为.apklib.But但它仍然无效。
最后我添加最后一个,但它也不起作用。所以如何写一个正确的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 

回答

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> 
    
0

试试这个:

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

我用这个和Theme.Appcompat.Light是可见的。