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' 

而且这个库有其他的依赖和资源文件,所以它会给你一个错误。

相关问题