0

我有這樣的錯誤:錯誤:(30,13)無法解析:庫/ com.android.support:程序兼容性-V7:22.2.1

Error:(30, 13) Failed to resolve: libs/com.android.support:appcompat-v7:22.2.1 

這裏我build.gradle文件:

apply plugin: `com.android.application` 

    android { 
     compileSdkVersion 25 
     buildToolsVersion "25.0.2" 
     defaultConfig { 
      applicationId "com.example.guestadmin.myapplication" 
      minSdkVersion 15 
      targetSdkVersion 25 
      versionCode 1 
      versionName "1.0" 
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     } 
     buildTypes { 
      release { 
       minifyEnabled false 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      } 
     } 
    } 

    dependencies { 

     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     compile 'com.android.support:appcompat-v7:25.2.0' 
     testCompile 'junit:junit:4.12' 

     compile fileTree(dir: 'libs', include: ['*.jar']) 
     compile 'libs/com.android.support:appcompat-v7:22.2.1' 

    } 
+0

任何人都可以告訴我爲什麼我得到這個30-13錯誤plz –

+0

您是否檢查過appcompat.v7:22.2.1庫是否被正確引用?也許你的版本已經改變或者找不到?如果您仍然需要,我會再次刪除參考並將其重新添加。 – Lepidopteron

回答

0

的錯誤是在這裏:

compile 'libs/com.android.support:appcompat-v7:22.2.1' 

您使用了錯誤的語法 - 你可以有一個罐子或多個JAR文件的依賴性。
一個jar文件,你可以添加:

dependencies { 
    compile files('libs/local_dependency.jar') 
} 

這有可能增加罐子編制的目錄。

dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
} 

在你還在導入項目中的所有jar文件,因爲你使用任何情況下:

compile fileTree(dir: 'libs', include: ['*.jar']) 

但要注意這種方式導入支持庫。
你只是導入該文件,因爲你正在使用

compile 'com.android.support:appcompat-v7:25.2.0' 

而且這個庫有其他的依賴和資源文件,所以它會給你一個錯誤。

相關問題