Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jp1017 opened this issue Oct 4, 2016 · 24 comments

Comments

@jp1017
Copy link

jp1017 commented Oct 4, 2016

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.

@anggrayudi
Copy link
Owner

anggrayudi commented Oct 9, 2016

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.

@benniaobuguai
Copy link

benniaobuguai commented Nov 7, 2016

I also met this problem today. Are you have solution now ?

Android Studio 2.2.2

@KaelLuo
Copy link

KaelLuo commented Nov 8, 2016

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 ?

@IgorEisberg
Copy link

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.

@jp1017
Copy link
Author

jp1017 commented Dec 3, 2016

@IgorEisberg wow, thanks, 👍 😄 it works. I just using

-x :app:mockableAndroidJar

@IgorEisberg
Copy link

IgorEisberg commented Dec 3, 2016

@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!

@jp1017
Copy link
Author

jp1017 commented Dec 3, 2016

Yes, but I can't disable others for I using Tinker which using thems. 😞

@IgorEisberg
Copy link

@jp1017 Oh fair enough. Well, at least the problem's solved for now! Gradle is such a buggy thing... -_-

@tchgithub
Copy link

@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]

@jp1017
Copy link
Author

jp1017 commented Dec 6, 2016

@tchgithub

:api:mockableAndroidJar,

For this, you should add below to your setting:

-x :api:mockableAndroidJar

For others, do it like this. enjoy it. 😄

@IgorEisberg
Copy link

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
            }
        }
    }
}

@jp1017
Copy link
Author

jp1017 commented Dec 8, 2016

Another workaround: In your project's main build.gradle, inside "allprojects":

@IgorEisberg 👍 After add this to my build.gradle, I found this in gradle console:

:app:mockableAndroidJar SKIPPED

It worked too. 👍 , Thank you.

More important, this would work for other modules, it may worked for @tchgithub

@IgorEisberg
Copy link

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')) {

@hyy007
Copy link

hyy007 commented Dec 19, 2016

I do like this, but it didn't work. Please can you give another way to resolve it? Thx a lot! @jp1017

@jp1017
Copy link
Author

jp1017 commented Dec 19, 2016

@hyy007 May be you should show some codes.

@hyy007
Copy link

hyy007 commented Dec 20, 2016

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:

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes."
But I don't know the where's the right question... I restarted the Android Studio or restart the PC (Windows 7 system), it didn't help, either~ ‘(>﹏<)′ wuwu~ @jp1017

@jp1017
Copy link
Author

jp1017 commented Dec 20, 2016

@hyy007 what for other projects? gradle version? just try any you can.

@hyy007
Copy link

hyy007 commented Dec 22, 2016

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.

@anggrayudi
Copy link
Owner

Try Hidden API v24 and this problem will be solved.

@jp1017
Copy link
Author

jp1017 commented Apr 18, 2017

@anggrayudi 25 still existed while the first compiling.

@xicomdev
Copy link

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

@aivision369
Copy link

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

@cikal
Copy link

cikal commented Jun 9, 2019

@IgorEisberg wow thanks dude.. 👍
just try your trick and my problem get solved, you save my day..

-x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x :app:compileReleaseUnitTestSources

@IgorEisberg
Copy link

@cikal Glad it's still useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants