Java Ant(build.xml)相当于Eclipse';s构建路径->;出口?
我有一个使用浓缩咖啡的Android测试项目,我正试图用Ant构建它。我可以很好地构建测试应用程序。将其安装到设备和所有设备上。问题是,每当我尝试使用 adb壳牌am仪器-w com.test.package/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner 我在命令提示符下得到以下信息:Java Ant(build.xml)相当于Eclipse';s构建路径->;出口?,java,android,eclipse,ant,android-espresso,Java,Android,Eclipse,Ant,Android Espresso,我有一个使用浓缩咖啡的Android测试项目,我正试图用Ant构建它。我可以很好地构建测试应用程序。将其安装到设备和所有设备上。问题是,每当我尝试使用 adb壳牌am仪器-w com.test.package/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner 我在命令提示符下得到以下信息: INSTRUMENTATION_RESULT: shortMsg=java.lang.Clas
INSTRUMENTATION_RESULT: shortMsg=java.lang.ClassNotFoundException
INSTRUMENTATION_RESULT: longMsg=java.lang.ClassNotFoundException: Didn't find class "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner" on path: /system/framework/com.google.android.maps.jar:/system/framework/android.test.runner.jar:/data/app/test.apk:/data/app/myApp.apk
INSTRUMENTATION_CODE: 0
在logcat中:
E/AndroidRuntime(27558):java.lang.RuntimeException:无法
实例化检测
ComponentInfo{com.avi.app.test.automation/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner}:
java.lang.ClassNotFoundException:未找到类
“com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner”
在路径上:
/system/framework/com.google.android.maps.jar:/system/framework/android.test.runner.jar:/data/app/test.apk:/data/app/myApp.apk
如果选中Configure Build Path->Order and Export
下我的浓缩咖啡罐旁边的复选框,我可以在Eclipse中运行测试。我注意到,如果不选中此框,我会得到与上面完全相同的错误消息
我需要知道的是如何在这里用Ant模拟Eclipse的行为?
下面是我的build.xml文件中的一个片段(主要由Eclipse中的Export->Ant build文件生成):
…(很多罐子)。。。
…(更多的罐子)。。。
…(东西)。。。
您看到的错误是由第三方jar未打包在APK中引起的。
android ant构建的默认行为是,只有在application project/libs文件夹中找到的JAR才会打包到apk中。
将espresso-1.1-bundled.jar复制到应用程序项目的/libs文件夹中,您就没事了
另一件要考虑的事情,你最好用Android工具生成Buff.xml,如这里所描述的: