androidx.databinding migration

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

androidx.databinding migration

G Andro
Hi Everyone.

I'm having an issue migrating to androidx.databinding. Somehow, android.support.annotation.NonNull is still referenced by sqlite when using Room database.

Here's my project build.gradle:

[code]

ext {
    archLifecycleVersion = '2.0.0'
    roomVersion = '2.1.0-alpha02'
    pagingVersion = '2.1.0-beta01'

    supportLibVersion = '1.0.0'
}

buildscript {
    ext.kotlin_version = '1.2.51'
 
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath 'com.google.guava:guava:19.0'

        classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
    }
}

...

[/code]

Here's the app build.gradle

[code]

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
        mavenCentral()
        google()
    }

    dependencies {
        classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.0'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.0"
    defaultConfig {
        applicationId "app.id"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        //multiDexEnabled false
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4096m"
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "androidx.appcompat:appcompat:$rootProject.supportLibVersion"
    implementation "com.google.android.material:material:$rootProject.supportLibVersion"

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'

    implementation 'com.github.bumptech.glide:glide:4.8.0'
    kapt 'com.github.bumptech.glide:compiler:4.8.0'

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    // architecture components
    implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-runtime:$rootProject.archLifecycleVersion"
    implementation "androidx.room:room-runtime:$rootProject.roomVersion"
    implementation "androidx.paging:paging-runtime:$rootProject.pagingVersion"
    kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"
    kapt "androidx.room:room-compiler:$rootProject.roomVersion"

    kapt "androidx.databinding:databinding-compiler:3.2.0-alpha16"

    testImplementation 'junit:junit:4.12'
}

configurations {
    all {
        exclude group: 'com.android.support'
        exclude group: 'org.sqlite'
        exclude module: 'httpclient'
        exclude module: 'commons-logging'

    }
}
[/code]


Running this

./gradlew :app:assembleDebug

outputs this error:

[stacktrace]

e: error: cannot access NonNull
  class file for android.support.annotation.NonNull not found
  Consult the following stack trace for details.
  com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.support.annotation.NonNull not found
e: [kapt] An exception occurred: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
        at org.sqlite.core.NativeDB._open_utf8(Native Method)
        at org.sqlite.core.NativeDB._open(NativeDB.java:71)
        at org.sqlite.core.DB.open(DB.java:174)
        at org.sqlite.core.CoreConnection.open(CoreConnection.java:220)
        at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:25)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
        at org.sqlite.JDBC.createConnection(JDBC.java:114)
        at androidx.room.verifier.DatabaseVerifier$Companion.create(DatabaseVerifier.kt:81)
        at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:78)
        at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:54)
        at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:63)
        at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
        at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
        at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:99)
...

[/stacktrace]

I'm using AndroidStudio3.0-beta

Does anyone have an idea on this issue?

Thanks.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.