1.Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
解决办法:1.Build——Rebuild Project 一般情况下解决本次的问题 下次打开project还会出现
2.在内层build.gradle 的 android{} 内部添加代码
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:27.1.1'
}
}
2.
Configuration 'compile' is obsolete and has been replaced with 'implementati 配置的api有些过时
解决办法:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-core-ui:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
需要改成如下:
compile 改成implementation
androidTestCompile改成androidTestImplementation
testCompile 改成testImplementation
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-core-ui:25.3.1'
implementation 'com.android.support:design:25.3.1'
testImplementation 'junit:junit:4.12'
}
---------------------
作者:Song先森
来源:CSDN
原文:https://blog.csdn.net/Song_74110/article/details/80387307
版权声明:本文为博主原创文章,转载请附上博文链接!
---------------------
3.Android studio 导入依赖, 构建时报错
Error: Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()
Invoke-customs are only supported starting with Android O (--min-api 26)
在主工程的build.gradle中添加以下代码,指定jdk版本为1.8
android {
......
//指定jdk版本
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
---------------------
作者:旺仔大牛
来源:CSDN
原文:https://blog.csdn.net/adojayfan/article/details/81531270
版权声明:本文为博主原创文章,转载请附上博文链接!
5.
一个文件在jar包中多次出现
More than one file was found with OS independent path 'META-INF/androidx.core_core.version'
Android studio错误]More than one file was found with OS independent path 'META-INF/rxjava.properties'
在defaultConfig{}内添加
packagingOptions{
exclude 'META-INF/xxxx'
exclude 'META-INF/xxxx'
}
例如
packagingOptions {
exclude 'META-INF/androidx.core_core.version'
exclude 'META-INF/proguard/androidx-annotations.pro'
exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
}
博客源地址:https://blog.csdn.net/pyfysf/article/details/78486201
6.Error: Program type already present: android.support.v4.app.INotificationSideChannel
如果在使用androidx库时, 又不小心间接使用了其他的老库, 可能会遇到如下的报错:
Program type already present: android.support.v4.os.ResultReceiver
Error: Program type already present: android.support.v4.app.INotificationSideChannel
Error: Program type already present: xxxxxxxx(此处可能会有各种变形)
解决办法
可以尝试在gradle.properties中添加:
android.useAndroidX=true
android.enableJetifier=true
作者:vb12
链接:https://www.jianshu.com/p/0cfd76a74c60
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。