我已在我的MainActivityTest
类中配置了以下权限规则:
@Rule
public GrantPermissionRule permissionRule =
GrantPermissionRule.grant(RECORD_AUDIO, WRITE_EXTERNAL_STORAGE);
当我运行以下命令在模拟器上执行api 27的测试时:
./gradlew connectedCheck
出现以下错误
com.example.myapplication.MainActivityTest > testLaunch_main_activity[Pixel_XL_API_27(AVD) - 8.1.0] FAILED
androidx.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you forget to launch the activity. (test.getActivity() or similar)?
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
令人惊讶的是,应用信息设置中显示已授予权限,但在使用API版本27(或更低版本)的模拟器上运行测试时仍会要求权限。
有人能否确认这是否是某个Android插件中的错误,还是我漏掉了什么。