Android单元测试-ClassdefNotFound

Android单元测试-ClassdefNotFound,android,unit-testing,junit,Android,Unit Testing,Junit,我试图为Android编写一个单元测试,但在我的一个测试方法中执行以下非常简单的代码时,我遇到了一个“NoClassdefFound”错误: public void testAAA(){ testAPI1 test = new testAPI1(); test.makeApiCall1(); } testAPI1类如下所示: public class testAPI1 implements SomeInterface{ public void makeApiCall1

我试图为Android编写一个单元测试,但在我的一个测试方法中执行以下非常简单的代码时,我遇到了一个“NoClassdefFound”错误:

public void testAAA(){
    testAPI1 test = new testAPI1();
    test.makeApiCall1();
}
testAPI1类如下所示:

  public class testAPI1 implements SomeInterface{
   public void makeApiCall1(){
      //do something
  }
}

SomeInterface就是一些接口。 然而,当我删除“SomeInterface”时,一切都正常

清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mamlambo.article.simplecalc.test" android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
    android:label="@string/app_name">
    <uses-library android:name="android.test.runner" />
</application>

<uses-sdk android:minSdkVersion="7" />
<instrumentation android:targetPackage="com.mamlambo.article.simplecalc"
    android:name="android.test.InstrumentationTestRunner" 
    android:label="Simple Calc Test"/>
 </manifest> 


到底是什么问题?

问题是找不到我实现的接口。接口在我引用的另一个项目中,显然没有正确引用。 我所做的是将该项目导出到一个jar文件中(没有AndroidManifest!),然后将其导入到我的测试项目中,从那时起,一切正常