Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

Unable to resolve dependency Android Studio 3.0

It's good to have a Updated Android Studio 3.0. But I am facing a problem with Android Studio 3.0, I just created a new project in Android Studio 3.0. Then I got some error

I solved these by changing dependencies to latest version and issues solved.

But, when I added a dependency of facebook account-kit sdk com.facebook.android:account-kit-sdk:4.+

I am getting following errors-:

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.facebook.android:account-kit-sdk:4.+. Open File
Show Details

build.gradle(app)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ultimate.devil.logintest"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.facebook.android:account-kit-sdk:4.+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

NOTE -:

  • I am following Facebook Developers Docs

  • I have tried by changing compile to implementation

  • I have also tried changing com.facebook.android:account-kit-sdk:4.+ to com.facebook.android:account-kit-sdk:4.11.0 and com.facebook.android:account-kit-sdk:4.27 by googling latest version of Facebook Account-Kit SDK

  • I have also tries StackOverFlow Answers with possible with same problem. But no one help me

Screenshot

enter image description here

question from:https://stackoverflow.com/questions/47001656/unable-to-resolve-dependency-android-studio-3-0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After some research I have solved this issue.

Step 1-:

I disable the Gradle offline work in settings.

File > Settings > Build, Execution, Deployment > Gradle > Uncheck Offline Work

enter image description here

Step 2-:

Then, I just changed compile 'com.facebook.android:account-kit-sdk:4.+' to api 'com.facebook.android:account-kit-sdk:4.+'

I don't know exactly why it's work. I see api in docs Reference

Now it works :)

EDIT -

Now, I am able to use both api or implementation and everything works fine.

Thanks,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...