【问题标题】:Compiler can not find AndroidInstrumentationTestCase2 when building Android app test code with Android makefile build system使用Android makefile构建系统构建Android应用测试代码时编译器找不到AndroidInstrumentationTestCase2
【发布时间】:2010-03-25 17:07:55
【问题描述】:

我有一个项目,其中包含一些 Android 测试代码(将适当的元素 <uses-library><instrumentation> 添加到 AndroidManifest.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;
                   ^

【问题讨论】:

    标签: android android-manifest android-build


    【解决方案1】:

    在找到解决方法之前,我在这个问题上苦苦挣扎了大约一天。如果您使用 Android.mk 文件来构建您的应用程序,请确保添加以下行:

    LOCAL_SDK_VERSION := current
    

    我发现的其他解决方案建议将此行添加到清单的应用程序部分,但这对我来说似乎没有任何区别:

    <uses-library android:name="android.test.runner" />
    

    【讨论】:

      猜你喜欢
      • 2013-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-27
      相关资源
      最近更新 更多