-
Notifications
You must be signed in to change notification settings - Fork 28
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
java.lang.RuntimeException: java.lang.ClassNotFoundException: android.app.Application #4
Comments
I'm definitely had a working example but now i see the same issue. I will check what i can do. Also saw a different error
|
Alright thank you very much. I've also tried it at home and I've got the same error on Mac as on Linux. |
When you have the time then try to get a working library example with the plugin from robolectric team. I have no idea when i will find the time |
Our issue could be related to https://code.google.com/p/android/issues/detail?id=156027 |
I tried a simple line at different position and I'm confused about the result. |
Missing R looks like a different issue which can be resolved. http://stackoverflow.com/questions/24842927/appcompat-v7-package-does-not-exist But when i get the error |
Replace the ActionBarActivity with a simple FragmentActivity and it works for me. But this is not acceptable when we like to use the appcompat library.
Perhaps this could be done with robolectric 3.0 because there is much more appcompat support. |
Robolectric 3.0-SNAPSHOT seems to be compatible with Activities extending ActionBarActivity. I had a simple example working in AS although it would fail when running in command line |
@marcoRS |
The issue with ActionBarActivity can definitively avoided with robolectric 3.0-SNAPSHOT With robolectric 2.4 this works only for application modules or if you switching back to simple FragmentActivity and avoid appcompat. Or someone find a proper solution. Some additional discussion about this topic http://stackoverflow.com/questions/28767817/android-studio-1-1-0-robolectric-2-4-causes-java-lang-annotation-annotationfor/28825095?noredirect=1#comment45936404_28825095 |
@vanniktech I have updated the library example. Would be nice if you could try if it works for you too. For Android Studio you must run first an unit test from the main module and then you can run tests from library module or you will get the issue #9 |
When I run
However that's not a real issue for me since I would test Android Activity related stuff only in the app module and there the test works perfectly fine. What's weird though when I try to run the tests in Android Studio, I get this error in core/build.gradle:
I've double checked and the file is present: |
Thank you for reporting. I will take a look later. First issue should be easy to fix because the path looks wrong Second issue could be relay on different execution root. Could you get the absolut path? |
I was able to fix the second error:
needs to be replaced with:
Afterwards you can execute the tests in Android Studio and from the Terminal. If you want I can create a PR (in the library branch) for that. |
I would be thankful for each help |
There you go #10 |
Thank you for your PR. Both issues results from different paths on command line and Android Studio. Please try again ;) |
Great changes! Now every test works and an AssertionError is thrown. Seems like we're finally able to test in Android Studio. Seems like this one can be closed. |
When I try to run your library example and want to execute the
RobolectricCoreTest
I get this exception:Is there any way that I can fix that one? Basically every Unit Test class works except for
RobolectricCoreTest
Adding
android.sourceSets.test.java.srcDirs += "build/generated/source/r/debug"
worked for theR.
issue.The text was updated successfully, but these errors were encountered: