0

In my application I use RoboGuice and the configuration for RoboGuice requires to add an Application-class and specify it in the AndroidManifest.xml file in the application-tag using the 'android:name' attribute.

So this is how my applicaiton-tag in the manifest looks like:

<application android:label="Worktime" android:icon="@drawable/logo" android:name=".guice.Application">

This always works and still does when I compile inside my IDE (IntelliJ) and deploy it to my device. However when I want to run my tests using Ant (and only via Ant, this also still works in the IDE) I have this error on the console:

[exec] android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate application eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: eu.vranckaert.worktime.guice.Application in loader dalvik.system.PathClassLoader@44e88928 [exec] INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to instantiate application eu.vranckaert.worktime.guice.Application: java.lang.ClassNotFoundException: eu.vranckaert.worktime.guice.Application in loader dalvik.system.PathClassLoader@44e88928

This has worked before but started failing since I upgraded my 'Android SDK Tools' to revision 17 and the 'Android SDK Platform-tools' to revision 11.

Anyone who had this issue also or who knows how to fix it?

dirkvranckaert
  • 1,364
  • 1
  • 17
  • 30
  • did you check [this](http://stackoverflow.com/questions/9820675/gson-noclassdeffounderror-after-adt-and-sdk-tools-update-to-v17) – Selvin Apr 04 '12 at 09:04
  • No that's not the solution, in fact it's not the same problem at all! In the link you shared it's a dependecy problem in Eclipse (and the ADT plugin). All my libraries, both in the app-project as the test-project) are in a 'libs' directory. Here it's a problem on the command-line that it cannot find my class (maybe also dependency issue but not Eclipse related...) – dirkvranckaert Apr 04 '12 at 09:51

2 Answers2

0
I think that the error saying

java.lang.ClassNotFoundException: 

is occur only when you have create new class Activity and not declare(register) that in manifest file

please check if you have any new activity and not declare(register) that activity in manifest file 

Thanks. 
Zumbarlal Saindane
  • 1,199
  • 11
  • 24
  • If I understand you correctly you are saying that I have to check if all my activities are defined in the AndroidManifest.xml. And that's the case, everything is defined well. In fact what you are saying is not correct! Not a single test is executed (or tried to launch), it's the initialization that fails, AND only using Ant! If I execute it from Eclipse or IntelliJ IDEA the tests are running just fine... – dirkvranckaert Apr 04 '12 at 11:02
0

we might have encountered the same error - In my case the solution was to separate the Ant targets to two calls (i.e. "ant myParameters myTarget1 myTarget2", and "ant myParameters debug delivery"). Hope this works for you, anyhow - Google need to add better support for their undocumented/faulty changes (and stackoverflow isn't the best place for questions that are not originated in stupidity, as the lifetime of a complex question isn't too long here).

Community
  • 1
  • 1
Jon Bonbon Jovi
  • 91
  • 1
  • 1
  • 6