Migration to androidx.databinding on AndroidStudio 3.0












2















I'd like to ask if it's possible to migrate to androidx.databinding in AndroidStudio 3.0.
I don't want to upgrade to AndroidStudio 3.2 just yet, and it seems that I can only import android.databinding instead of the androidx version.



I have added this in my app gradle file:



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


Project gradle dependency:



classpath 'com.android.tools.build:gradle:3.1.0'


All the other androidx libraries I added on gradle can be imported in code, but not databinding. Has anyone here still using AndroidStudio 3.0 successfully used androidx.databinding?



Thanks.



UPDATE:



In the app build.gradle, I updated the dependency from -jre8 to -jdk8:



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


This is the app build.gradle dependencies:



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.1"

testImplementation 'junit:junit:4.12'
}

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


And this is the project build.gradle versions:



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

supportLibVersion = '1.0.0'
}


I executed this to find out more about the issue on my project:



./gradlew :app:kaptDebugKotlin



and I got this error:



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)


So it seems that the underlying sqlite library is still using android.support.annotation.NonNull. Any idea on how to solve this?



Thanks.










share|improve this question





























    2















    I'd like to ask if it's possible to migrate to androidx.databinding in AndroidStudio 3.0.
    I don't want to upgrade to AndroidStudio 3.2 just yet, and it seems that I can only import android.databinding instead of the androidx version.



    I have added this in my app gradle file:



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


    Project gradle dependency:



    classpath 'com.android.tools.build:gradle:3.1.0'


    All the other androidx libraries I added on gradle can be imported in code, but not databinding. Has anyone here still using AndroidStudio 3.0 successfully used androidx.databinding?



    Thanks.



    UPDATE:



    In the app build.gradle, I updated the dependency from -jre8 to -jdk8:



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


    This is the app build.gradle dependencies:



    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.1"

    testImplementation 'junit:junit:4.12'
    }

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


    And this is the project build.gradle versions:



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

    supportLibVersion = '1.0.0'
    }


    I executed this to find out more about the issue on my project:



    ./gradlew :app:kaptDebugKotlin



    and I got this error:



    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)


    So it seems that the underlying sqlite library is still using android.support.annotation.NonNull. Any idea on how to solve this?



    Thanks.










    share|improve this question



























      2












      2








      2








      I'd like to ask if it's possible to migrate to androidx.databinding in AndroidStudio 3.0.
      I don't want to upgrade to AndroidStudio 3.2 just yet, and it seems that I can only import android.databinding instead of the androidx version.



      I have added this in my app gradle file:



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


      Project gradle dependency:



      classpath 'com.android.tools.build:gradle:3.1.0'


      All the other androidx libraries I added on gradle can be imported in code, but not databinding. Has anyone here still using AndroidStudio 3.0 successfully used androidx.databinding?



      Thanks.



      UPDATE:



      In the app build.gradle, I updated the dependency from -jre8 to -jdk8:



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


      This is the app build.gradle dependencies:



      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.1"

      testImplementation 'junit:junit:4.12'
      }

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


      And this is the project build.gradle versions:



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

      supportLibVersion = '1.0.0'
      }


      I executed this to find out more about the issue on my project:



      ./gradlew :app:kaptDebugKotlin



      and I got this error:



      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)


      So it seems that the underlying sqlite library is still using android.support.annotation.NonNull. Any idea on how to solve this?



      Thanks.










      share|improve this question
















      I'd like to ask if it's possible to migrate to androidx.databinding in AndroidStudio 3.0.
      I don't want to upgrade to AndroidStudio 3.2 just yet, and it seems that I can only import android.databinding instead of the androidx version.



      I have added this in my app gradle file:



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


      Project gradle dependency:



      classpath 'com.android.tools.build:gradle:3.1.0'


      All the other androidx libraries I added on gradle can be imported in code, but not databinding. Has anyone here still using AndroidStudio 3.0 successfully used androidx.databinding?



      Thanks.



      UPDATE:



      In the app build.gradle, I updated the dependency from -jre8 to -jdk8:



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


      This is the app build.gradle dependencies:



      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.1"

      testImplementation 'junit:junit:4.12'
      }

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


      And this is the project build.gradle versions:



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

      supportLibVersion = '1.0.0'
      }


      I executed this to find out more about the issue on my project:



      ./gradlew :app:kaptDebugKotlin



      and I got this error:



      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)


      So it seems that the underlying sqlite library is still using android.support.annotation.NonNull. Any idea on how to solve this?



      Thanks.







      data-binding android-studio-3.0 androidx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 14:40







      uan

















      asked Nov 19 '18 at 15:53









      uanuan

      567




      567
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378309%2fmigration-to-androidx-databinding-on-androidstudio-3-0%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378309%2fmigration-to-androidx-databinding-on-androidstudio-3-0%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini