Why is “3rd-party Gradle plug-ins may be the cause” showing after updating Gradle to 3.1.0?

前端 未结 5 984
不知归路
不知归路 2020-12-16 10:15

After updating Gradle to com.android.tools.build:gradle:3.1.0, in the log I now see:

Folder E:\\WORK\\App\\car_android\\carapp\\build\\

相关标签:
5条回答
  • 2020-12-16 10:27

    If you are receiving the warning:

    3rd-party Gradle plug-ins may be the cause

    in the build tab, it appears to be a known issue with Android Studio v3.1.x.
    According to this report, It might be related to Instant App provision, but even removing that from the run/Debug configuration does not appear to resolve the issue (at least not with my installation of AS v3.1.1).

    Please vote up this issue so that it will be given more attention by the Android Studio team and hopefully a timely fix.

    0 讨论(0)
  • 2020-12-16 10:30

    I delete two folder app\build\generated\source\kaptKotlin\debug and app\build\generated\source\kaptKotlin\release ("debug" and "release") and add in gradle:

    kapt {
            mapDiagnosticLocations = true
        }
    

    then the project is sync without problem.

    0 讨论(0)
  • 2020-12-16 10:35

    This happens because the Kapt annotation processor uses this directory to store Kotlin generated files.

    The directory is a new generated source set, the same way you can split your source files into src/main/java and src/main/kotlin

    However the Android Gradle plugin does not recognize this directory as a generated source set.

    For the most part this is completely harmless as most 3rd party processors are generating .Java files. Kapt writes them to the build/generated/source/kapt directory.

    0 讨论(0)
  • 2020-12-16 10:39

    According to this Android Studio issue, "The root issue with Kapt is that the Kapt resolver in IDEA from JetBrains registers those folders as 'being in a invalid path'. This is a misuse of the API."

    As of 6/11/2018, there's a fix in place to double-check those messages and suppress ones about paths which are actually valid.

    0 讨论(0)
  • 2020-12-16 10:50

    It had worked in my project! ->

    Your build.gradle Project should look like the image below:

    Note: It could be little bit different if you are not using Realm and some Google Services

    • Now, Let's start ->Go to you build.gradle App

    Platform modules targeting Android The update of the experimental multiplatform projects feature introduces support for Android platform modules. These modules should apply the corresponding plugin in the Gradle build script and can use the shared code from a common module:

    1. You will copy this inside of your build.gradle ON THE TOP ADD IT-

    Kapt diagnostic locations As of now, kapt, the Kotlin annotation processing tool, can offer links to locations in the original Kotlin code rather than generated Java stubs as it reports errors encountered during annotation processing. You can enable this feature by adding these lines to the Gradle build script (build.gradle):

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-platform-android'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'
    // ...
    

    2. NOW ADD IT:

    kapt {
        mapDiagnosticLocations = true
    }
    dataBinding {
        enabled = true
    }
    

    IntelliJ IDEA plugin improvements Kotlin 1.2.30 brings various improvements in the IntelliJ IDEA Kotlin plugin, including performance improvements, bug fixes, and new inspections and intentions.

    For some projects this is important : You will copy this inside of your build.gradle-

     allprojects {
    repositories {
        jcenter()
        google()
    }
    

    It will look like the below image

    Now we need to add the implementations inside of dependencies{...// } build.gradle:

    // Architecture Component - Room
    implementation "android.arch.persistence.room:runtime:1.1.0-beta1"
    kapt "android.arch.persistence.room:compiler:1.1.0-beta1"
    
    // Lifecyles, LiveData and ViewModel
    kapt 'com.android.databinding:compiler:3.1.0'
    
    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:1.1.1"
    
    // alternatively, just ViewModel
    implementation "android.arch.lifecycle:viewmodel:1.1.1"
    
    // alternatively, just LiveData
    implementation "android.arch.lifecycle:livedata:1.1.1"
    kapt "android.arch.lifecycle:compiler:1.1.1"
    
    // Room (use 1.1.0-beta1 for latest beta)
    implementation "android.arch.persistence.room:runtime:1.0.0"
    kapt "android.arch.persistence.room:compiler:1.0.0"
    
    // Paging
    implementation "android.arch.paging:runtime:1.0.0-alpha7"
    
    // Test helpers for LiveData
    testImplementation "android.arch.core:core-testing:1.1.1"
    
    // Test helpers for Room
    testImplementation "android.arch.persistence.room:testing:1.0.0"
    

    * *

    1. Clean your project
    2. Build it
    3. That's it!

    More Info: Android Site :) Let me know if it works! (If it does not work, I will try to help you finding a better way)

    0 讨论(0)
提交回复
热议问题