未找到android.support.v4.app.ActivityCompatApi23的类文件

时间:2018-04-16 12:14:54

标签: android gradle android-activity android-databinding

我想为我的新应用尝试-o,但我遇到了一些问题。当我尝试运行我的应用时,我总是收到此错误(Get-Command Get-Help).ParameterSets我做了一些研究并找到了与我的问题相关的this问题。但我找不到任何可以解决我问题的答案。

databinding

这是完整的错误 错误:

class file for android.support.v4.app.ActivityCompatApi23 not found

我删除此行

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    flavorDimensions ""

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 24
        versionName "1.0"
        versionNameSuffix ""
    }

    buildTypes {
        release {
            minifyEnabled false
        }
        debug {
            minifyEnabled false
        }
    }

    dataBinding {
        enabled = true
    }

    lintOptions {
        disable 'InvalidPackage'
        baseline file("lint-baseline.xml")
        abortOnError false
    }

    task printLintResultsIfFailed {
        doLast {
            if (lintRelease.state.failure != null) {
                def report = new File(project.buildDir, "reports/lint-results-release.xml")
                print report.text
            }
        }
    }

    tasks.all {
        task -> if (task.name == "lintRelease") task.finalizedBy 'printLintResultsIfFailed'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

task sourceJar(type: Jar, dependsOn:[assemble]) {
    from android.sourceSets.main.java.srcDirs
    classifier "source"
}


dependencies {

    implementation project(path: ':integration')

    kapt 'com.android.databinding:compiler:3.1.1'
}

我不会得到那个错误

那么我做错了什么?

1 个答案:

答案 0 :(得分:0)

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'
        }
    }
}

我从这本书中得到:Error:(59, 8) error: cannot access ActivityCompatApi23 class file for android.support.v4.app.ActivityCompatApi23 not found