0

I want to try databinding for my new app but I've faced some issues. When I try to run my app I'm always getting this error class file for android.support.v4.app.ActivityCompatApi23 not found I did some research and found this question that is related to my problem. But I can't found any answer that would solve my problem.

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

Here's the full error error:

cannot access ActivityCompatApi23
public abstract class NetworkActivity<T extends java.lang.Object> extends android.support.v4.app.FragmentActivity implements courier.Hub, courier.Receiver<eu.myapp.registration.network.HttpResult<T>> {
                ^
  class file for android.support.v4.app.ActivityCompatApi23 not found

As soon as I deleted this line

dataBinding {
        enabled = true
    }

I won't get that error

So what I'm doing wrong?

David
  • 3,055
  • 4
  • 30
  • 73

1 Answers1

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

I got from this one : Error:(59, 8) error: cannot access ActivityCompatApi23 class file for android.support.v4.app.ActivityCompatApi23 not found

Bee Pov
  • 1
  • 1