2013-10-19 159 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是可見的。