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
NoClassDefFoundError: com/android/internal/os/BackgroundThread #2160
Comments
Post your code. What does this mean if we can't reproduce it? |
I just download the sample project form : |
Make sure you use the The Gradle version should be updated along with the Intellij/Android Studio version: http://tools.android.com/tech-docs/new-build-system/version-compatibility. The easiest way is to keep everything updated. Besides this issue should have gone in |
I use the ./gradlew clean test --info, produce the same error information. |
And I upgrade my gradle to 2.9, still got this same problem |
Here, I updated their plugins and I use gradle 2.9:
|
Thanks for you to solve my problems patiently,but after I use this build.gradle file, I still failed. Executing task ':testDebugUnitTest' (up-to-date check took 0.008 secs) due to: com.example.activity.DeckardActivityTest > testSomething FAILED
1 test completed, 1 failed |
@ltn614 It shows you are using gradle 2.6. Make sure you are using the latest JDK 8 version. |
What is the update on this? |
still no any progress, I try this on computer at home, still same problem, it's a windows 10 desktop, I am sure this is not working for me. |
@ltn614 I am thinking it still has to do with your setup. I cannot reproduce your problem. |
Errors like these are usually caused by having mis-matched Robolectric jars on your system. Try running |
I'm repro'ing this issue consistently. I'm using SDK 21 for most of my tests. Tests that are configured to run on SDK 18 fail with this exception, since the reset of the shadows can't find BackgroundThread. It looks like the shadow reset is not accounting for old SDKs. Here's the full exception:
|
I can report getting the exact same error as @cesar1000, consistently. |
I am also getting this using 3.0. I get this even running the deckard sample project tests. When I try to import com.android.internal.os.BackgroundThread it does not resolve. |
I just switched all my tests to SDK 21 and the issue is gone. It's definitely a bug in Robolectric though. |
It doesn't work for me with sdk 21. The test project is using sdk 21 Leo. On Sat, Mar 19, 2016 at 3:42 PM, César Puerta notifications@github.com
|
Was consistently repro'ing the exact same error with stacktrace. After problems with a difficult proxy, I suspected some .jars were missing or corrupt. Connected through a proxy-less network, went to .m2 directory and deleted 'repository' directory, causing the dependencies to re-download at runtime. It now works as expected. |
@drawers yes,I didn't download the jars correctly. After remove |
@alwaystest glad it helps. @erd |
My probs is I have implement my code and add library also.it working fine latest model but not support android 4.1,my min sdk file is 15.It maces class not found error |
The root of this problem is that robolectric manually downloads Maven dependencies, instead of letting Gradle handle it: https://github.com/robolectric/robolectric/blob/master/robolectric/src/main/java/org/robolectric/internal/dependency/MavenDependencyResolver.java So everything may work just fine normally, using Gradle; but fails when robolectric tries to download the same artifacts. In my particular case, the reason it couldn't find the jar(s) was because it couldn't parse the
And the reason this was a I updated my m2-settings file, and deleted the bogus |
@jhansche I'm not sure this is the root cause of this particular problem - we ran into the same problem at Twitter though and reached the same conclusion as you did. I could still repro the exception after that fix, and it seemed to be caused by an attempt to reset the environment for API 21 with the environment configured for API 18. |
deleting the .m2 directory (thx @drawers) fixed this for me. |
I'm having the same issue on sdk 21, and build process is gradle. Is there any fix for this? |
deleting the .m2 directory (thx @drawers) fixed this for me. thanks!!!! |
I download few sample project, none of them is working. When I run test in grade or AndroidStudio,print the following error message:estSomething FAILED
java.lang.NoClassDefFoundError: com/android/internal/os/BackgroundThread
Caused by:
java.lang.ClassNotFoundException: com.android.internal.os.BackgroundThread
The text was updated successfully, but these errors were encountered: