2016-09-28 106 views
0

当我向我的android studio项目添加一些依赖项时出现此错误........我在做什么错了?Gradle无法解析Android Studio中的依赖关系。这是我的错误

请参阅下面的代码。提前致谢。

repositories { 
     mavenCentral() 
     flatDir { 
      dirs 'libs' 
     } 
    } 

    dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     compile 'com.android.support:appcompat-v7:23.1.1' 
     compile 'com.android.support:support-v4:23.1.1' 
     compile 'com.google.android.gms:play-services:8.3.0' 
     compile 'org.json:json:20141113' 
     // This library handles authentication and authorization 
     compile 'com.spotify.sdk:[email protected]' 
     // This library handles music playback 
     compile 'com.spotify.sdk:[email protected]' 
     // All other dependencies for your app should also be here: 
     compile 'com.android.support:appcompat-v7:23.1.1' 

    } 
+0

后错误太多帖子,从发布'得到这个错误',这将检查logcat –

+0

@PavneetSingh我不明白你的评论..你是什么意思请? –

+0

发布你的日志猫,并分享你的build.gradle(模块项目) –

回答

0

从应用级的build.gradle文件中删除下面的代码,并把它放到你projadct级的build.gradle

repositories { 
     mavenCentral() 
     flatDir { 
      dirs 'libs' 
     } 
    } 
0

请试试这个...

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

2)。该testCompiler缺少testCompile 'junit:junit:4.12'

在摇篮工程沿添加此testCompiler编译文件树下面像如下─

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

给出并卸下

repositories { 
     mavenCentral() 
     flatDir { 
      dirs 'libs' 
     } 
    } 

,并将其粘贴

+0

谢谢@Shivam,我仍然面临错误。看到下面的错误。 –

+0

错误:无法解析:com.spotify.sdk:spotify-player-beta22-noconnect-2.20b: 错误:无法解析:com.spotify.sdk:spotify-auth-beta22-noconnect-2.20b: –

+0

这显示了这些编译依赖关系的问题,即编译'com.spotify.sdk:[email protected]'并编译'com.spotify.sdk:spotify-auth-beta22-noconnect-2.20b @aar'检查这两个可能会出现错误 –

相关问题