2013-03-03 61 views
6

我目前正試圖讓android的新建立系統(http://tools.android.com/tech-docs/new-build-system/using-the-new-build-system)工作。因此,我創建了一個build.gradle文件具有以下內容:Android的工具Gradle插件

apply plugin: 'android' 

android { 
    compileSdkVersion 15 
    target='android-15'  

    defaultConfig { 
     targetSdkVersion 15 
     minSdkVersion 8 
     versionCode 10 
    } 

    sourceSets { 
     main { 
      manifest { 
       srcFile 'AndroidManifest.xml' 
      } 
     } 
    } 
} 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile 'com.google.android:android:4.0.1.2' 
    compile project(':ActionBarSherlock') 
    compile fileTree(dir: './libs', include: '*.jar') 
} 

我基於的文檔做到了這一點,所以我希望它的工作;不過,我得到了以下錯誤消息:

ERROR: The default configuration has an indirect dependency on Android API level 14, but minSdkVersion for variant 'Debug' is API level 8

拆卸時在Android 4.0.1.2的顯式依賴,錯誤消失,但我留下編譯錯誤,因爲Android的文件本身不能得到解決。作爲一個例子,ActivityView作爲類無法找到。據推測,我可以降級到Android的舊版本以匹配minSdkVersion,但我想編譯對照sdk 15,最低爲8

插件本身在版本0.3的根build.gradle中聲明。

有沒有人知道如何解決這個錯誤?

感謝, 馬蒂亞斯

回答

4

嗯不知何故,我得到這個使用支持API完整的Android作爲工作的依賴性,而不是......至少現在的工作......

+1

順便說一句,在'COM .google.android:android'依賴項會自動添加到您的依賴項列表中,並干擾您選擇的Android版本。 – Steven 2013-03-06 07:10:44

+1

是的,不需要添加對com.google.android:android的依賴關係。這就是android.compileSdkVersion的用途(它可以代替android.target,因此你可以刪除該行) – 2013-03-13 01:18:03

相關問題