我正在使用UIAutomator和AndroidJUnit4作为运行程序在一个单独的空项目中为我的应用程序编写检测测试。它在我的设备上运行良好。为了在Firebase上进行测试,它需要我提供的应用APK,以及从C:\ Users \ user \ MyApplication \ app \ build \ outputs \ apk \ androidTest \ debug以及运行测试时获取的测试APK失败,并显示以下错误:“无法找到检测目标软件包:”我缺少什么了吗?
我在androidTest包中创建了另一个清单,目标包为红色,带有“无法解析符号”,没有任何更改。
我也将targetPackage更改为我要测试的应用程序的程序包的名称,以防出现问题,并且没有任何更改。
我的androidTest清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.myapplication.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="28"/>
<instrumentation
android:targetPackage="com.example.myapplication"
android:name="androidx.test.runner.AndroidJUnitRunner"
/>
<application
tools:replace="label" android:label="SampleTest"/>
</manifest>
答案 0 :(得分:0)
经过大量研究,我发现gradle会自动将目标包更改为我正在编写测试的应用程序包名称。 因此,我不得不将测试移到我的应用程序项目中并从中生成测试apk,因此它将具有相同的目标程序包,同时为两者设置相同的签名。