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

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.
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.
I also still don't know what happens with hidden API v23. On some users, this error doesn't appear. Otherwise, some users are facing this problem. For me, I don't face this problem.
Let's try a new framework.jar from different devices, this trick may fix the problem. The current jar was picked from SGS3 LTE with BlissPop ROM, Android 6.0.1, Bliss version v6.2. You can find the jar in from Android 6.0 devices. Upload it to me and I'll make a new modified android.jar.
I also met this problem today. Are you have solution now ?
Android Studio 2.2.2
I met this problem days ago, for now I clean all the files by hand every every time...., and this do makes me annoy. Does anyone find the solution about this ?
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:
- Go to File -> Settings -> Build, Execution, Deployment -> Compiler
- Add to "Command-line Options":
-x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x :app:compileReleaseUnitTestSources - Press "OK" and try to Rebuild Project again.
Now the unit testing compilation tasks will always be skipped and no errors will be thrown.
@IgorEisberg wow, thanks, :+1: :smile: it works. I just using
-x :app:mockableAndroidJar
@jp1017 That works too, I just feel as if disabling all of the "unit testing" tasks is better because it's also faster (you have 3 tasks less instead of just 1 task less). Enjoy!
Yes, but I can't disable others for I using Tinker which using thems. :disappointed:
@jp1017 Oh fair enough. Well, at least the problem's solved for now! Gradle is such a buggy thing... -_-
@IgorEisberg I add -x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x :app:compileReleaseUnitTestSources to my settings but it still show Error:java.lang.NullPointerException (no error message)
Information:Gradle tasks [:api:generateDebugSources, :api:generateDebugAndroidTestSources, :api:mockableAndroidJar, :api:prepareDebugUnitTestDependencies, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :core:generateDebugSources, :core:mockableAndroidJar, :core:prepareDebugUnitTestDependencies, :core:generateDebugAndroidTestSources, :library:generateDebugSources, :library:generateDebugAndroidTestSources, :library:mockableAndroidJar, :library:prepareDebugUnitTestDependencies, :model:generateDebugSources, :model:mockableAndroidJar, :model:prepareDebugUnitTestDependencies, :model:generateDebugAndroidTestSources]
@tchgithub
:api:mockableAndroidJar,
For this, you should add below to your setting:
-x :api:mockableAndroidJar
For others, do it like this. enjoy it. :smile:
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
}
}
}
}
Another workaround: In your project's main build.gradle, inside "allprojects":
@IgorEisberg :+1: After add this to my build.gradle, I found this in gradle console:
:app:mockableAndroidJar SKIPPED
It worked too. :+1: , Thank you.
More important, this would work for other modules, it may worked for @tchgithub
Yup, it covers the whole project, no matter how you name your modules. It's also more portable since it'll work immediately even if you transfer the project to another computer.
To skip all Test tasks you can change the "if" statement to:
if (task.name.contains('Test') || task.name.equals('mockableAndroidJar')) {
I do like this, but it didn't work. Please can you give another way to resolve it? Thx a lot! @jp1017
@hyy007 May be you should show some codes.
java.lang.NullPointerException(no error message). That's the error yestoday, and then when I rebuild the project, it shows: " Error:org.gradle.api.internal.changedetection.state.FileCollectionSnapshotImpl cannot be cast to org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot Possible causes for this unexpected error include:
- Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
- The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
- Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
@hyy007 what for other projects? gradle version? just try any you can.
Thank you for your answers for me. I checked out a new version and reopened it, then it went OK just like before... And I still don't know what's the question....I'm not sure if it is the SVN's problem when I work with my teammates.
Try Hidden API v24 and this problem will be solved.
@anggrayudi 25 still existed while the first compiling.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed with multiple errors, see logs
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' })
compile 'com.victor:lib:1.0.4'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
testCompile 'junit:junit:4.12'
compile 'com.braintreepayments.api:drop-in:3.+'
compile 'com.github.esafirm.android-image-picker:imagepicker:1.3.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.opentok.android:opentok-android-sdk:2.10.+'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.google.code.gson:gson:2.+'
compile(name:'instaply-sdk-1.0.2', ext:'aar')
} apply plugin: 'com.google.gms.google-services'
Any suggestion
I have faced same issue and i have tried above all the answers but it want work for me. I think its worked in other cases. After 2 to 3 hours i will got the solution i am just extending the answer so i post this comment. In case my current project minimumSdk 15 and my modal project or dependency library's minimumSdk 18 so i have change my current project minimumSdk 18 and it worked for me. So check your library project's version
@IgorEisberg wow thanks dude.. :+1: just try your trick and my problem get solved, you save my day..
-x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x :app:compileReleaseUnitTestSources
@cikal Glad it's still useful!