Android Studio 3.6.1 with Gradle Plugin Version 3.6.1 and Gradle Version 5.6.4 not working

后端 未结 8 1440
余生分开走
余生分开走 2021-01-03 07:38

My application is working very well. I have just updated Android Studio 3.6.1,

After updating Android Studio I got this dialog and I am going to upda

相关标签:
8条回答
  • 2021-01-03 08:14

    I have tried many ways to solve this problem as follow:

    1st solution: I have tried the solution of Mayur Sojitra and it worked for one day. (Next day I got the same problem again.)

    2nd solution: I have tried to revert back with a lower version of Gradle that is 3.5.0 and It's working but I wanted to use the latest version only. (Way to find a new solution)

    3rd solution: I am using firebase dependencies and I thought that error is coming because of Firebase version conflicts with Gradle so I have updated all the firebase repository. (May this is also working for you)

    4th solution: I have used ObjectBox library so updated that version to the latest 2.5.1.

    5th solution: Finally I caught the problem that My Internet Connection is restricted (as per company rules) and My Gradle and other dependencies are not downloading successfully so I thought updating all dependencies and download it successfully will be the solution for this weird question.

    Do let me know If you have any questions or still get a problem.

    Thank you.

    0 讨论(0)
  • 2021-01-03 08:14

    Possible solution:

    Upgrade the version of plugins in Top-level build.gradle.

    Detail:

    I upgraded the Gradle version from 5.4.1 to 5.6.4, and the plugin version from 3.5.3 to 3.6.2, and then I encountered a problem that the class could not find.

    I have used Realm in the project and the top-level build.gradle is:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        /.../
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.6.2'
            classpath "io.realm:realm-gradle-plugin:5.8.0"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    

    This problem seems like some library/plugin does not process R classes in R.jar but in R.java after the Gradle plugin version greater than 3.6.0. See here for detail.

    And the solution is to upgrade Realm to a newer version, for me is 6.0.2. See here for detail.

        dependencies {
            classpath 'com.android.tools.build:gradle:3.6.2'
            classpath "io.realm:realm-gradle-plugin:6.0.2" // <- modify
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    
    0 讨论(0)
提交回复
热议问题