【问题标题】:Could not resolve all dependencies for configuration ':app:_debugCompile'-Facebook无法解析配置 ':app:_debugCompile'-Facebook 的所有依赖项
【发布时间】:2015-12-18 22:26:19
【问题描述】:

我一直在尝试将 Facebook 分享功能集成到我的应用程序中。但我不断收到以下错误:

错误:配置项目 ':app' 时出现问题。 无法解析配置 ':app:_debugCompile' 的所有依赖项。 找不到任何与 com.android.support:support-v4:[22,23) 匹配的版本。 在以下位置搜索: //jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml //jcenter.bintray.com/com/android/support/support-v4/ //repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml //repo1.maven.org/maven2/com/android/support/support-v4/ 文件:/Users/geraldgoh/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml 文件:/Users/geraldgoh/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/maven-metadata.xml 文件:/Users/geraldgoh/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/ 要求: Facebook:app:unspecified > com.facebook.android:facebook-android-sdk:4.6.0

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.dothis.facebook"
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),  'proguard-rules.pro'
    }
}
}

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
}

Android 清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dothis.facebook" >

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />


    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER"    />
        </intent-filter>
    </activity>
</application>

</manifest>

谁能帮我解决这个错误。谢谢。

【问题讨论】:

    标签: android facebook


    【解决方案1】:

    这是因为你写错了编译的依赖信息。

    这是 SDK 而不是 SADK。

    compile 'com.facebook.android:facebook-android-sdk:4.0.0

    【讨论】:

    • 是的,我已经更改了它,但错误仍然出现。@Animesh Jena
    • 错误:配置项目 ':app' 时出现问题。 > 无法解析配置“:app:_debugCompile”的所有依赖项。 > 找不到任何与 com.android.support:support-v4:[22,23) 匹配的版本。
    • 试试这个..:- compile 'com.facebook.android:facebook-android-sdk:4.0.0' 如果你仍然面临同样的问题..你可以去你的sdk经理并更新它。通过这个链接:-stackoverflow.com/a/20830540/4531611
    • @marian:-欢迎,祝您编码愉快。如果您认为我的回答对您有任何帮助,请点赞或投票给最佳答案,那太好了。
    猜你喜欢
    • 1970-01-01
    • 2021-05-02
    • 2023-03-19
    • 2017-05-14
    • 2016-09-19
    • 2017-08-26
    • 1970-01-01
    • 2016-02-14
    • 2014-11-17
    相关资源
    最近更新 更多