无法解决依赖性Android Studio 3.0 [英] Unable to resolve dependency Android Studio 3.0
问题描述
最好安装更新的 Android Studio 3.0 .但是我遇到了 Android Studio 3.0 的问题,我刚刚在 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
我通过将 dependencies
更改为最新版本并解决了问题来解决了这些问题.
I solved these by changing dependencies
to latest version and issues solved.
但是,当我添加 facebook account-kit sdk的dependency
com.facebook.android:account-kit-sdk:4.+
我遇到以下错误-:
错误:无法解决对':app @ debug/compileClasspath'的依赖关系: 无法解析com.facebook.android:account-kit-sdk:4.+.打开 文件
显示详细信息
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'
}
注意-:
-
我正在关注 Facebook开发者文档
I am following Facebook Developers Docs
我尝试通过将compile
更改为implementation
我还尝试通过搜索最新版本的 Facebook Account-Kit SDK
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
我也尝试了可能存在相同问题的StackOverFlow答案.但是没人帮我
I have also tries StackOverFlow Answers with possible with same problem. But no one help me
屏幕截图
推荐答案
经过研究,我已经解决了这个问题.
After some research I have solved this issue.
第1步:
我在设置中禁用了 Gradle离线工作.
文件>设置>构建,执行,部署> Gradle>取消选中脱机工作
File > Settings > Build, Execution, Deployment > Gradle > Uncheck Offline Work
第2步:
然后,我将 compile 'com.facebook.android:account-kit-sdk:4.+'
更改为 api 'com.facebook.android:account-kit-sdk:4.+'
Then, I just changed compile 'com.facebook.android:account-kit-sdk:4.+'
to api 'com.facebook.android:account-kit-sdk:4.+'
我不知道它为什么起作用.我在文档 api "nofollow noreferrer">参考
I don't know exactly why it's work. I see api in docs Reference
现在可以使用了:)
编辑-
现在,我可以同时使用api
或implementation
,并且一切正常.
Now, I am able to use both api
or implementation
and everything works fine.
谢谢
这篇关于无法解决依赖性Android Studio 3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!