Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

Which are the two types of plugins in gradle?

There are two general types of plugins in Gradle, binary plugins and script plugins.

What is the use of plugins in gradle?

Plugin is nothing but set of all useful tasks, such as compiling tasks, setting domain objects, setting up source files, etc. are handled by plugins. Applying a plugin to a project means that it allows the plugin to extend the project's capabilities.

What is the purpose of a gradle Java plugin?

The Java Gradle Plugin development plugin can be used to assist in the development of Gradle plugins. It automatically applies the Java Library plugin, adds the gradleApi() dependency to the api configuration and performs validation of plugin metadata during jar task execution.

What is gradle plugin Android?

The Android Gradle plugin (AGP) is the official build system for Android applications. It includes support for compiling many different types of sources and linking them together into an application that you can run on a physical Android device or an emulator.


To solve the issue, remove Instant App Provision from the "Run Configurations" and leave only the Gradle-Aware Make.

Run -> Edit Configurations..

My Run/Debug configurations after successful build

I have AndroidStudio 3.1, Gradle Plugin 3.1.0 and Kotlin library version 1.2.30.


I restarted Android Studio and the problem disappeared.

Click File -> Invalidate Caches/Restart

Every time I change the gradle file, I must restart Android Studio to or the problem returns.

You can also try this:

  1. Re-ordered repositories to:

    mavenCentral()
    maven { url 'https://jitpack.io' }
    google()
    jcenter()
    
  2. Clearing this folder: user's ~/.gradle/caches and deleting app build folder manually, then clean and rebuild.


What fixed the issue for me:

  • Change gradle plugin version to 3.1.0
  • Change Kotlin version to 1.2.30
  • Then Android studio changed gradle wrapper to version 4.4
  • Then Android studio was saying that the build tools version used was 27.0.3 and that I should change it to 27.0.3 so I also changed the target SDK to 27
  • I added this to my gradle.build:

    kapt {
         generateStubs = true
     }
    

I hope it helps


at android studio v3.1.2 , happen Error:

Folder D:\AndroidProjects\app\build\generated\source\kaptKotlin\debug
Folder D:\AndroidProjects\app\build\generated\source\kaptKotlin\release
3rd-party Gradle plug-ins may be the cause

because dataBinding use apply plugin: 'kotlin-kapt' so add

kapt {
    generateStubs = true
}
  1. Change gradle plugin version to 3.1.2
  2. Change Kotlin version to 1.2.30
  3. Then Android studio changed gradle wrapper to version 4.4
  4. Then Android studio was saying that the build tools version used was 27.1.1 and that I should change it to 27.1.1 so I also changed the target SDK to 27

Here are some steps that I've followed. In my case it's fixed the issue!

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:

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

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):

kapt {
    mapDiagnosticLocations = true
}

Add this:

allprojects {
        repositories {
            jcenter()
            google()
        }
    }

Don't forget the next:

// 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 and That's it!

Add all of this, Clean your project, build and That's it! :) Let me know if this works! (If it is not working for you, I will help you with another solution)

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)

If you give a downVote explain why