Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:12:15+00:00 2026-06-09T21:12:15+00:00

We are having a problem running integration unit tests in eclipse when using RoboGuice

  • 0

We are having a problem running integration unit tests in eclipse when using RoboGuice 2.0 on our application.

When we try to run the unit test class on the emulator (as an Android JUnit Test) we get the following exception, so the test doesn’t even run:

junit.framework.AssertionFailedError: Exception in constructor: testAddNote (java.lang.NoClassDefFoundError: br.org.certi.android.pgpsip.client.measure.activity.MeasureActivity
at br.org.certi.android.pgpsip.client.test.MeasureActivityTest.<init>(MeasureActivityTest.java:14)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:103)
at android.test.AndroidTestRunner.getTest(AndroidTestRunner.java:127)
at android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:55)
at android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:81)
at android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:418)
at android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:399)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:364)
...

Here is the relevant part of the test class, I hope its enough:

public class MeasureActivityTest extends ActivityInstrumentationTestCase2<MeasureActivity> {

public MeasureActivityTest() {
    super(MeasureActivity.class);
}

Using maven (mvn clean install) the test runs perfectly.

One important thing is that , if the activity class has no dependency on RoboGuice, it works fine on eclipse too.

The relevant part of the pom.xml:

<dependency>
    <groupId>org.roboguice</groupId>
    <artifactId>roboguice</artifactId>
    <version>2.0</version>
</dependency>
<dependency>
    <groupId>com.google.inject.extensions</groupId>
    <artifactId>guice-multibindings</artifactId>
    <version>3.0</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </exclusion>
    </exclusions>
</dependency>

We noted that when we copy the roboguice, guice and inject dependencies to the libs folder of the application (and mark the dependencies as provided on the pom.xml), the tests run beautifully on eclipse. So it seems to be a problem of the android unit test running in ADT not being able to identify the maven dependencies.

It seems very similar to this problem:
Android/RoboGuice/Maven: ClassNotFoundException in Eclipse, but not from Maven command line, but when running the unit test and not the actual application.

Any ideas on how to work around this problem would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:12:16+00:00Added an answer on June 9, 2026 at 9:12 pm

    We seem to have found the problem.

    We are using two projects on eclipse, actually three: one parent, one for the application and one for the tests.

    The NoClassDefFoundError problem came from RoboGuice’s classes being loaded from the wrong dependency when running the test from inside eclipse.

    We noticed a message like: “… had used a different Lroboguice/util/RoboContext; during pre-verification …”, a little above the error on the LogCat view.

    What seems to have solved the issue was to remove the (unneeded) dependency from the test
    project and kept it only on the actual application project and now everything works fine both with maven and with eclipse.

    This seems to indicate that the dex generation with eclipse was handling the RoboGuice jars more than once, generating different references when running the application to be tested. I don’t know how to solve this if the dependencies were actually needed.

    Thought I would answer this here in hopes it helps others …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having a problem starting or running any activity unit tests from within eclipse.
i'm having a problem running an integration test through Gallio. The test works fine
I'm having a problem with running an application I made on another computer. This
I'm using django with app-engine-patch and I'm having this wierd problem running manage.py dumpdata
I am having a problem running java programs in Eclipse, When i Click on
I am having a problem running the 'test' Rake task from IntelliJ Idea in
I having problem managed thread parallel in console application. I am running 10 threads
I'm having a problem running a T4 template using TextTransform.exe on my build server.
I'm having problem when running my Windows Forms program. In the program, I have
I'm having a problem running Apache + Subversion with SSL behind an Nginx proxy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.