1

我有一个项目,其中包含一些 Android 测试代码(带有适当的元素,<uses-library>并且<instrumentation>,添加到AndroidManifest.xml)。这在 Eclipse 中运行良好。但是,它无法构建 with mm,声称它找不到测试运行器类:

/home/orospakr/code/my-android/packages/apps/MyApp/src/ca/orospakr/myapp/test/functional/MyActivityTest.java:5: cannot find symbol
symbol  : class ActivityInstrumentationTestCase2
location: package android.test
import android.test.ActivityInstrumentationTestCase2;
                   ^
4

1 回答 1

1

I struggled with this problem for about a day before finding the fix. If you are using an Android.mk file to build your application, make sure to add this line:

LOCAL_SDK_VERSION := current

Other solutions I found suggested adding this line to the application section of the manifest, but it doesn't seem to make any difference for me:

<uses-library android:name="android.test.runner" />
于 2012-09-24T14:11:43.763 回答