错误:(59,8)错误:无法访问未找到android.support.v4.app.ActivityCompatApi23的ActivityCompatApi23类文件 [英] Error:(59, 8) error: cannot access ActivityCompatApi23 class file for android.support.v4.app.ActivityCompatApi23 not found
问题描述
这是我的build.gradle
apply plugin:'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion26.0.2
android {
configurations.all {
resolutionStrategy.force'com.google.code .findbugs:jsr305:1.3.9'
}
}
defaultConfig {
applicationIdcom.example.user2.trafficmap
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName1.1
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
知识库{
mavenCentral()
maven { urlhttps://maven.google.com}
}
依赖项{
implementation'com.android.support.constraint:约束布局:1.0.2'
编译fileTree(包括:['* .jar'],dir:'libs')
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})
compile'io.nlopez.smartlocation:library: 3.3.3'
compile'com.android.support:appcompat-v7:25.3.1'
compile'com.google.android.gms:play-services-location:11.8.0'
编译'com.google.android.gms:play-services-base:11.8.0'
编译'com.google.android.gms:play-services-maps:11.8.0'
编译'com.github.arimorty:floatingsearchview:2.1.1'
compile'com.google.android.gms:play-services-places:11.4.2'
testCompile'junit:junit:4.12'
编译'com.android.support:recycle rview-v7:26.0.0'
}
当我运行我的项目时,我看到了这个错误:(59,8)错误:无法访问
android.support.v4.app的ActivityCompatApi23类文件错误:
没有找到ActivityCompatApi23
和
错误:执行失败的任务':app:compileDebugJavaWithJavac'。
编译失败;
我该如何解决这个问题? :
configurations.all {
resolutionStrategy.eachDependency {DependencyResolveDetails details - >
def requested = details.requested
if(requested.group = ='com.android.support'){
if(!requested.name.startsWith(multidex)){
details.useVersion '25 .3.0'
}
}
}
}
This is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
defaultConfig {
applicationId "com.example.user2.trafficmap"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url "https://maven.google.com" }
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'io.nlopez.smartlocation:library:3.3.3'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.google.android.gms:play-services-base:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.github.arimorty:floatingsearchview:2.1.1'
compile 'com.google.android.gms:play-services-places:11.4.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:26.0.0'
}
when I run my project I see this errors
Error:(59, 8) error: cannot access ActivityCompatApi23 class file for android.support.v4.app.ActivityCompatApi23 not found
and
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
How can I fix this problem ??? :(
I solved this problem by add this code in build.gradle
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
这篇关于错误:(59,8)错误:无法访问未找到android.support.v4.app.ActivityCompatApi23的ActivityCompatApi23类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!