android-hidden-api: clean Error:Execution failed for task ':app:mockableAndroidJar'. > java.lang.NullPointerException (no error message) in Android Studio 2.2

Error:

20161004103811

gradle:

··· compileSdkVersion 23 buildToolsVersion “23.0.3” ···

This error comes when using your lib of android-23, and it disappear when using the original android-23.jar.

We know task ':app:mockableAndroidJar' is experimental in Android Studio 2.1.3, and I close this.

Android Studio clean 时产生 Error:Execution failed for task ‘:app:mockableAndroidJar’ > java.lang.NullPointerException (no error message)

but google makes this stable in Android Stuido 2.2, and I can’t this.

This error comes for some days until today I found this may be result from your lib.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 24 (2 by maintainers)

Most upvoted comments

Another workaround: In your project’s main build.gradle, inside “allprojects”:

allprojects {
    repositories {
        jcenter()
    }
    gradle.taskGraph.whenReady {
        tasks.each { task ->
            if (task.name.equals('mockableAndroidJar')) {
                task.enabled = false
            }
        }
    }
}

I have this issue as well as I’m using a modified android.jar (which has all the hidden API revealed). I don’t use the unit testing and there’s no apparent way to disable it in Android Studio 2.2.2, so I found a workaround for this problem:

  1. Go to File -> Settings -> Build, Execution, Deployment -> Compiler
  2. Add to “Command-line Options”: -x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x :app:compileReleaseUnitTestSources
  3. Press “OK” and try to Rebuild Project again.

Now the unit testing compilation tasks will always be skipped and no errors will be thrown.