开发者

Compiler can not find AndroidInstrumentationTestCase2 when building Android app test code with Android makefile build system

I have a project with some Android test code in it (with the appropriate elements, <uses-library> and <instrumentation>, added to AndroidManifest.xml). This works fine in Eclipse. However, it fails to build with mm, claiming that it can't find the test-runner classes:

/home/orospakr/code/my-android/packages/apps/MyApp/src/ca/orospakr/myapp/test/functional/MyActivityTest.java:5: c开发者_如何学Cannot find symbol
symbol  : class ActivityInstrumentationTestCase2
location: package android.test
import android.test.ActivityInstrumentationTestCase2;
                   ^


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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜