compile
..
Failed to resolve: android.arch.persistence.room:runtime:1.1.1 Open File Show in Project Structure dialog
尝试将版本更改为1.0.0
compile
..
Failed to resolve: android.arch.persistence.room:runtime:1.1.1 Open File Show in Project Structure dialog
尝试将版本更改为1.0.0
Answers:
我com.google.gms:google-services
已从更新到3.1.1
,3.2.0
并且警告停止出现。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
}
}
我对com.google.gms:google-services发出了同样的警告。
解决方案是将build.gradle项目中文件中的类路径com.google.gms:google-services升级为类路径“ com.google.gms:google-services:3.2.0”。
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在Android Studio verion 3.1中,依赖词complie替换为实现
android studio 3.1中的警告依赖项
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
Android Studio 3.1中的依赖关系确定
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
由Android Studio 3.1为新项目生成的Gradel。
访问 https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html
有关详细信息https://docs.gradle.org/current/userguide/declaring_dependencies.html
我已经将com.google.gms:google-services从3.2.0更新为3.2.1,并且警告不再出现。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}
classpath 'com.google.gms:google-services:4.1.0'
不是最新更新,是的,它大于3.2.0
。仍然没有解决方案!
打开位于以下位置的build.gradle文件:
这是编写依赖库的旧方法(适用于gradle版本2和更低版本):
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/volley.jar')
compile 'com.android.support:support-v4:21.+'
}
这是为gradle版本3导入依赖关系的新(正确)方法:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation files('libs/volley.jar')
implementation 'com.android.support:support-v4:21.+'
}
https://issuetracker.google.com/issues/72479188指示插件有时会引入“编译”依赖项,这就是触发警告的原因。可能最容易给该问题加注星标,然后等待他们修复它,以指出导致该问题的插件。
我没有使用就会遇到此问题com.google.gms:google-services
。解决此类问题的解决方案如下:
build.gradle
所有项目和模块的文件。或者只是全局搜索关键字“编译”以查找导致此警告的位置。
./gradlew assembleDebug -d > gradle.log
gradle.log
或其他文件的文件中,因为该信息太多。然后搜索单词“ WARNING”以查找中的位置gradle.log
,通常您可以找到引起警告的依赖性或插件。在我的情况下,这是由Realm库引起的,将其更新到Realm的最新版本(到目前为止为5.1.0)后,问题已解决!
这是工作的gradle脚本:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "io.realm:realm-gradle-plugin:5.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.1'
}
}
转到项目级别的build.gradle文件,您将找到以下突出显示的行
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4' //place your cursor over here
//and hit alt+enter and it will show you the appropriate version to select
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.2' //the same as previously
}
在我的情况下,这是一个旧的依赖项,正在将compile用于传递性依赖项: com.jakewharton.hugo
从我的gradle中删除后,它编译。
我尝试将google gms服务更改为com.google.gms:google-services:3.2.1
Android Studio 3.0.1中 的最新版本,但警告仍然存在。
所推荐的编译器,我改变了所有compile
依赖关系implementation
,并testCompile
以testImplementation
这样的..
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-ads:12.0.1'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.firebase:firebase-perf:12.0.1'
implementation 'com.google.firebase:firebase-appindexing:12.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
最后,警告被删除!
您可以执行以下两个选择:
刚刚从加build.gradle
从build script
classpath 'com.google.gms:google-services:3.2.0'
并且所有依赖项都"compile"
替换为"implementation"
。
这对我有用。
classpath
,则必须在buildscript
块内使用它;而且,不能implementation
在buildscript
块内使用。
当前版本是4.2.0:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
}
}
对我来说,将编译更改为实现已修复
之前
compile 'androidx.recyclerview:recyclerview:1.0.0'
compile 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
后
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
//Retrofit Dependencies
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'