Kamil Lelonek
Kamil Lelonek

Reputation: 14744

Testing android scala project

Has anyone discovered already how to test Android projects written in scala? I still got NoClassDefFoundError even when I'm just declaring scala object.

What is more, some of my activities are written in Java and they are fully testable.

I'm testing with Android Junit Test Case in Java.


EDIT:

Here is my stack trace:

java.lang.NoClassDefFoundError: PACKAGE.DataBaseManager
at PACKAGE.TESTING_CLASS.setUp(TESTING_CLASS.java:16)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:177)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1619)

My TESTING_CLASS is simple

private DataBaseInterface database;

@Override
protected void setUp() throws Exception {
    super.setUp();

    if (database == null) {
        database = new DataBaseManager(mContext);
    }
}

@Override
protected void tearDown() throws Exception {
    super.tearDown();
    mContext.deleteDatabase(DataBaseHelper.DATABASE_NAME());
    database = null;
}

Upvotes: 2

Views: 277

Answers (1)

Kamil Lelonek
Kamil Lelonek

Reputation: 14744

If anyone will have this problem in the future it's enough to add AndroidProguardScala Nature additionally to your main and test project.

Upvotes: 2

Related Questions