使用 Android makefile 构建系统构建 Android 应用程序测试代码时,编译器找不到 AndroidInstrumentationTestCase2
我有一个项目,其中包含一些 Android 测试代码(将适当的元素
和
添加到 AndroidManifest.xml 中。 xml
)。这在 Eclipse 中工作得很好。但是,它无法使用 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;
^
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: cannot find symbol
symbol : class ActivityInstrumentationTestCase2
location: package android.test
import android.test.ActivityInstrumentationTestCase2;
^
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在找到解决方案之前,我与这个问题斗争了大约一天。如果您使用 Android.mk 文件来构建应用程序,请确保添加此行:
我发现的其他解决方案建议将此行添加到清单的应用程序部分,但似乎没有对我有任何影响:
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:
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: