Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IllegalAccessException: can not access a member of class com.android.build.gradle.tasks.ManifestProcessorTask

Android studio keeps telling me that the build has failed. I am not using Kotlin and all my code is in JAVA. I keep getting this error ONLY when i want to build/run the project. I always need to delete .gradle folder and restart Android studio to get this working again. It's not an IDE issue i feel as I have used both IDE version 3.1 and 3.3. I have also updated Kotlin to the latest version currently 1.2.70

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:processProdDebugManifest'.
   > java.lang.IllegalAccessException: Class kotlin.reflect.jvm.internal.FunctionCaller$FieldSetter can not access a member of class com.android.build.gradle.tasks.ManifestProcessorTask with modifiers "private"


ext.kotlin_version = "1.2.70"

After a complete restart and invalidating cache the build succeeds, but after any new changes i make it cant build again until i restart the entire IDE and delete the .gradle folder

here are my root Project version numbers

ext {
    // SDK and tools
    minSDK = 18
    targetSDK = 28
    compileSDK = 28
    buildTools = '28.0.2'

    // SUPPORT LIBRARY
    SupportLibrary = '28.0.0-rc02'

    // Debug the App
    debugMode = true
    minify = true
    proguard = false
    multidex = false

    // App Versioning
    versionCode = 7
    versionName = 0.7
}
like image 569
mughalasim Avatar asked Sep 20 '18 11:09

mughalasim


4 Answers

Every time this problem occurs, I restart / invalidate the cache and the problem is resolved.

File > Invalidate Caches/Restart... > Invalidate and Restart

like image 199
Vinicius Paes de Camargo Avatar answered Nov 07 '22 20:11

Vinicius Paes de Camargo


If you using the alpha gradle build tool

classpath 'com.android.tools.build:gradle:3.3.0-alpha10'

then downgrade to

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

This worked for me.

like image 28
joecizac Avatar answered Nov 07 '22 20:11

joecizac


I solved the issue by updating to Android

Studio 3.3 Canary 11 Build #AI-182.4323.46.33.5012296

Make sure to update the gradle as well. A pop up will prompt on your first boot after the update.

like image 1
newbieCoder.pkg Avatar answered Nov 07 '22 20:11

newbieCoder.pkg


This was a bug in gradle version 3.3.0-alpha13 which can be fixed by upgrading you gradle version.

To fix this issue, upgrade your gradle version in project level build.gradle

    classpath 'com.android.tools.build:gradle:3.4.0-alpha01'

Original answer https://stackoverflow.com/a/52965104/3948854

like image 1
Rishabh Sagar Avatar answered Nov 07 '22 19:11

Rishabh Sagar