安卓30模拟器上的快车道截屏



我正在尝试设置快速通道截屏,以自动生成不同语言的应用程序截屏。

我正在运行一个带有API 30的AVD,它看起来创建屏幕截图工作得很好,因为我可以在设备文件资源管理器中找到文件。但我无法运行bundle exec fastlane screengrab

它总是导致"拒绝权限"或"没有这样的文件或目录"错误。有人成功地将创建的屏幕截图从模拟器拉到本地目录吗?

这是我收到的输出:

[12:57:57]: WARNING: fastlane requires your locale to be set to UTF-8. To learn more go to https://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables
Der Befehl "cat" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
[12:58:03]: Successfully loaded 'D:/Workspace/MyApp/fastlane/Screengrabfile' 📄
+----------------------------+-------------------------------------------------------------------+
|                        Detected Values from './fastlane/Screengrabfile'                        |
+----------------------------+-------------------------------------------------------------------+
| android_home               | $PATH                                                             |
| use_adb_root               | true                                                              |
| app_package_name           | packagename                                                |
| app_apk_path               | app/build/outputs/apk/debug/app-debug.apk                         |
| tests_apk_path             | app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk |
| locales                    | ["de-DE", "en-US"]                                                |
| clear_previous_screenshots | true                                                              |
+----------------------------+-------------------------------------------------------------------+
[12:58:03]: Using `adb` found at adb which is not within the specified ANDROID_HOME at $PATH
[12:58:03]: Using `aapt` found at C:UsersUSERAppDataLocalAndroidSdkbuild-tools29.0.2/aapt.EXE which is not within the specified ANDROID_HOME at $PATH
+-----------------------------+-------------------------------------------------------------------+
|                                 Summary for screengrab 2.162.0                                  |
+-----------------------------+-------------------------------------------------------------------+
| tests_package_name          | packagename.test                                           |
| android_home                | $PATH                                                             |
| locales                     | ["de-DE", "en-US"]                                                |
| clear_previous_screenshots  | true                                                              |
| output_directory            | fastlane/metadata/android                                         |
| skip_open_summary           | true                                                              |
| app_package_name            | packagename                                                |
| test_instrumentation_runner | androidx.test.runner.AndroidJUnitRunner                           |
| ending_locale               | en-US                                                             |
| use_adb_root                | true                                                              |
| app_apk_path                | app/build/outputs/apk/debug/app-debug.apk                         |
| tests_apk_path              | app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk |
| device_type                 | phone                                                             |
| exit_on_test_failure        | true                                                              |
| reinstall_app               | false                                                             |
| use_timestamp_suffix        | true                                                              |
+-----------------------------+-------------------------------------------------------------------+
[12:58:03]: Limiting the test classes run by `screengrab` to just those that generate screenshots can make runs faster.
[12:58:03]: Consider using the :use_tests_in_classes or :use_tests_in_packages option, and organize your tests accordingly.
[12:58:03]: Clearing phoneScreenshots within fastlane/metadata/android
[12:58:03]: $ adb -s emulator-5554 shell echo $EXTERNAL_STORAGE
[12:58:03]: ▸ /sdcard
[12:58:03]: $ adb -s emulator-5554 root
[12:58:03]: $ adb -s emulator-5554 wait-for-device
[12:58:03]: Cleaning screenshots on device
ls: /sdcard/packagename/screengrab/de-DE/images/screenshots: Permission denied
[12:58:03]: Exit status: 1
ls: /sdcard/packagename/screengrab/en-US/images/screenshots: Permission denied
[12:58:03]: Exit status: 1
[12:58:03]: $ adb -s emulator-5554 shell run-as packagename rm -rf /data/user/0/packagename/files/packagename/screengrab/de-DE/images/screenshots
ls: /data/data/packagename/files/packagename/screengrab/de-DE/images/screenshots: No such file or directory
[12:58:03]: Exit status: 1
ls: /data/data/packagename/app_screengrab/de-DE/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
ls: /data/data/packagename/screengrab/de-DE/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
ls: /data/user/0/packagename/files/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
ls: /data/data/packagename/files/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
ls: /data/data/packagename/app_screengrab/en-US/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
ls: /data/data/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:04]: Exit status: 1
[12:58:04]: Validating app APK
[12:58:04]: $ C:UsersUSERAppDataLocalAndroidSdkbuild-tools29.0.2/aapt.EXE dump permissions app/build/outputs/apk/debug/app-debug.apk
[12:58:04]: ▸ package: packagename
[12:58:04]: ▸ uses-permission: name='android.permission.DISABLE_KEYGUARD'
[12:58:04]: ▸ uses-permission: name='android.permission.WAKE_LOCK'
[12:58:04]: ▸ uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
[12:58:04]: ▸ uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
[12:58:04]: ▸ uses-permission: name='android.permission.CHANGE_CONFIGURATION'
[12:58:04]: Installing app APK
[12:58:04]: $ adb -s emulator-5554 install -t -r app/build/outputs/apk/debug/app-debug.apk
[12:58:04]: ▸ Performing Streamed Install
[12:58:04]: ▸ Success
[12:58:04]: Installing tests APK
[12:58:04]: $ adb -s emulator-5554 install -t -r app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
[12:58:05]: ▸ Performing Streamed Install
[12:58:05]: ▸ Success
[12:58:05]: Granting the permission necessary to change locales on the device
[12:58:05]: $ adb -s emulator-5554 shell pm grant packagename android.permission.CHANGE_CONFIGURATION
[12:58:05]: $ adb -s emulator-5554 shell getprop ro.build.version.sdk
[12:58:05]: ▸ 30
[12:58:05]: Granting the permissions necessary to access device external storage
[12:58:05]: $ adb -s emulator-5554 shell pm grant packagename android.permission.WRITE_EXTERNAL_STORAGE
[12:58:05]: $ adb -s emulator-5554 shell pm grant packagename android.permission.READ_EXTERNAL_STORAGE
[12:58:05]: $ adb -s emulator-5554 shell getprop ro.build.version.sdk
[12:58:06]: ▸ 30
[12:58:06]: $ C:UsersUSERAppDataLocalAndroidSdkbuild-tools29.0.2/aapt.EXE dump badging app/build/outputs/apk/debug/app-debug.apk
[12:58:06]: ▸ package: name='packagename' versionCode='1' versionName='1.0' compileSdkVersion='30' compileSdkVersionCodename='11'
[12:58:06]: ▸ sdkVersion:'29'
[12:58:06]: ▸ targetSdkVersion:'30'
[12:58:06]: ▸ uses-permission: name='android.permission.DISABLE_KEYGUARD'
[12:58:06]: ▸ uses-permission: name='android.permission.WAKE_LOCK'
[12:58:06]: ▸ uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
[12:58:06]: ▸ uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
[12:58:06]: ▸ uses-permission: name='android.permission.CHANGE_CONFIGURATION'
[12:58:06]: ▸ application-label:'MyApp'
[12:58:06]: ▸ application-label-af:'MyApp'
[12:58:06]: ▸ application-label-am:'MyApp'
[12:58:06]: ▸ application-label-ar:'MyApp'
[12:58:06]: ▸ application-label-as:'MyApp'
[12:58:06]: ▸ application-label-az:'MyApp'
[12:58:06]: ▸ application-label-be:'MyApp'
[12:58:06]: ▸ application-label-bg:'MyApp'
[12:58:06]: ▸ application-label-bn:'MyApp'
[12:58:06]: ▸ application-label-bs:'MyApp'
[12:58:06]: ▸ application-label-ca:'MyApp'
[12:58:06]: ▸ application-label-cs:'MyApp'
[12:58:06]: ▸ application-label-da:'MyApp'
[12:58:06]: ▸ application-label-de:'MyApp'
[12:58:06]: ▸ application-label-el:'MyApp'
[12:58:06]: ▸ application-label-en-AU:'MyApp'
[12:58:06]: ▸ application-label-en-CA:'MyApp'
[12:58:06]: ▸ application-label-en-GB:'MyApp'
[12:58:06]: ▸ application-label-en-IN:'MyApp'
[12:58:06]: ▸ application-label-en-US:'MyApp'
[12:58:06]: ▸ application-label-en-XC:'MyApp'
[12:58:06]: ▸ application-label-es:'MyApp'
[12:58:06]: ▸ application-label-es-US:'MyApp'
[12:58:06]: ▸ application-label-et:'MyApp'
[12:58:06]: ▸ application-label-eu:'MyApp'
[12:58:06]: ▸ application-label-fa:'MyApp'
[12:58:06]: ▸ application-label-fi:'MyApp'
[12:58:06]: ▸ application-label-fr:'MyApp'
[12:58:06]: ▸ application-label-fr-CA:'MyApp'
[12:58:06]: ▸ application-label-gl:'MyApp'
[12:58:06]: ▸ application-label-gu:'MyApp'
[12:58:06]: ▸ application-label-hi:'MyApp'
[12:58:06]: ▸ application-label-hr:'MyApp'
[12:58:06]: ▸ application-label-hu:'MyApp'
[12:58:06]: ▸ application-label-hy:'MyApp'
[12:58:06]: ▸ application-label-in:'MyApp'
[12:58:06]: ▸ application-label-is:'MyApp'
[12:58:06]: ▸ application-label-it:'MyApp'
[12:58:06]: ▸ application-label-iw:'MyApp'
[12:58:06]: ▸ application-label-ja:'MyApp'
[12:58:06]: ▸ application-label-ka:'MyApp'
[12:58:06]: ▸ application-label-kk:'MyApp'
[12:58:06]: ▸ application-label-km:'MyApp'
[12:58:06]: ▸ application-label-kn:'MyApp'
[12:58:06]: ▸ application-label-ko:'MyApp'
[12:58:06]: ▸ application-label-ky:'MyApp'
[12:58:06]: ▸ application-label-lo:'MyApp'
[12:58:06]: ▸ application-label-lt:'MyApp'
[12:58:06]: ▸ application-label-lv:'MyApp'
[12:58:06]: ▸ application-label-mk:'MyApp'
[12:58:06]: ▸ application-label-ml:'MyApp'
[12:58:06]: ▸ application-label-mn:'MyApp'
[12:58:06]: ▸ application-label-mr:'MyApp'
[12:58:06]: ▸ application-label-ms:'MyApp'
[12:58:06]: ▸ application-label-my:'MyApp'
[12:58:06]: ▸ application-label-nb:'MyApp'
[12:58:06]: ▸ application-label-ne:'MyApp'
[12:58:06]: ▸ application-label-nl:'MyApp'
[12:58:06]: ▸ application-label-or:'MyApp'
[12:58:06]: ▸ application-label-pa:'MyApp'
[12:58:06]: ▸ application-label-pl:'MyApp'
[12:58:06]: ▸ application-label-pt:'MyApp'
[12:58:06]: ▸ application-label-pt-BR:'MyApp'
[12:58:06]: ▸ application-label-pt-PT:'MyApp'
[12:58:06]: ▸ application-label-ro:'MyApp'
[12:58:06]: ▸ application-label-ru:'MyApp'
[12:58:06]: ▸ application-label-si:'MyApp'
[12:58:06]: ▸ application-label-sk:'MyApp'
[12:58:06]: ▸ application-label-sl:'MyApp'
[12:58:06]: ▸ application-label-sq:'MyApp'
[12:58:06]: ▸ application-label-sr:'MyApp'
[12:58:06]: ▸ application-label-sr-Latn:'MyApp'
[12:58:06]: ▸ application-label-sv:'MyApp'
[12:58:06]: ▸ application-label-sw:'MyApp'
[12:58:06]: ▸ application-label-ta:'MyApp'
[12:58:06]: ▸ application-label-te:'MyApp'
[12:58:06]: ▸ application-label-th:'MyApp'
[12:58:06]: ▸ application-label-tl:'MyApp'
[12:58:06]: ▸ application-label-tr:'MyApp'
[12:58:06]: ▸ application-label-uk:'MyApp'
[12:58:06]: ▸ application-label-ur:'MyApp'
[12:58:06]: ▸ application-label-uz:'MyApp'
[12:58:06]: ▸ application-label-vi:'MyApp'
[12:58:06]: ▸ application-label-zh-CN:'MyApp'
[12:58:06]: ▸ application-label-zh-HK:'MyApp'
[12:58:06]: ▸ application-label-zh-TW:'MyApp'
[12:58:06]: ▸ application-label-zu:'MyApp'
[12:58:06]: ▸ application-icon-160:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application-icon-240:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application-icon-320:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application-icon-480:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application-icon-640:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ application: label='MyApp' icon='res/mipmap-anydpi-v26/ic_launcher.xml'
[12:58:06]: ▸ testOnly='-1'
[12:58:06]: ▸ application-debuggable
[12:58:06]: ▸ launchable-activity: name='packagename.MainActivity'  label='MyApp' icon=''
[12:58:06]: ▸ feature-group: label=''
[12:58:06]: ▸   uses-feature: name='android.hardware.faketouch'
[12:58:06]: ▸   uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
[12:58:06]: ▸ main
[12:58:06]: ▸ supports-screens: 'small' 'normal' 'large' 'xlarge'
[12:58:06]: ▸ supports-any-density: 'true'
[12:58:06]: ▸ locales: '--_--' 'af' 'am' 'ar' 'as' 'az' 'be' 'bg' 'bn' 'bs' 'ca' 'cs' 'da' 'de' 'el' 'en-AU' 'en-CA' 'en-GB' 'en-IN' 'en-US' 'en-XC' 'es' 'es-US' 'et' 'eu' 'fa' 'fi' 'fr' 'fr-CA' 'gl' 'gu' 'hi' 'hr' 'hu' 'hy' 'in' 'is' 'it' 'iw' 'ja' 'ka' 'kk' 'km' 'kn' 'ko' 'ky' 'lo' 'lt' 'lv' 'mk' 'ml' 'mn' 'mr' 'ms' 'my' 'nb' 'ne' 'nl' 'or' 'pa' 'pl' 'pt' 'pt-BR' 'pt-PT' 'ro' 'ru' 'si' 'sk' 'sl' 'sq' 'sr' 'sr-Latn' 'sv' 'sw' 'ta' 'te' 'th' 'tl' 'tr' 'uk' 'ur' 'uz' 'vi' 'zh-CN' 'zh-HK' 'zh-TW' 'zu'
[12:58:06]: ▸ densities: '160' '240' '320' '480' '640' '65534'
[12:58:06]: Running tests for locale: de-DE
[12:58:06]: $ adb -s emulator-5554 shell am instrument --no-window-animation -w 
-e testLocale de_DE 
-e endingLocale en_US 
-e appendTimestamp true 
packagename.test/androidx.test.runner.AndroidJUnitRunner
[12:58:20]: ▸ packagename.ExampleInstrumentedTest:...
[12:58:20]: ▸ Time: 11.34
[12:58:20]: ▸ OK (3 tests)
[12:58:20]: Pulling captured screenshots for locale de-DE from the device
ls: /sdcard/packagename/screengrab/de-DE/images/screenshots: Permission denied
[12:58:20]: Exit status: 1
ls: /sdcard/packagename/screengrab/en-US/images/screenshots: Permission denied
[12:58:20]: Exit status: 1
[12:58:20]: $ adb -s emulator-5554 pull /data/user/0/packagename/files/packagename/screengrab/de-DE/images/screenshots C:/Users/USER/AppData/Local/Temp/d20201009-22720-woz01y
adb: error: failed to stat remote object '/data/user/0/packagename/files/packagename/screengrab/de-DE/images/screenshots': Permission denied
[12:58:20]: Exit status: 1
[12:58:20]: PERMISSION DENIED
[12:58:20]: $ adb -s emulator-5554 shell run-as packagename 'tar -cC /data/user/0/packagename/files/packagename/screengrab/de-DE/images screenshots' | tar -xvC C:/Users/USER/AppData/Local/Temp/d20201009-22720-woz01y
tar: Error opening archive: Failed to open '\.tape0'
run-as: exec failed for tar -cC /data/user/0/packagename/files/packagename/screengrab/de-DE/images screenshots: No such file or directory
[12:58:20]: Exit status: 1
[12:58:21]: $ adb -s emulator-5554 pull /data/data/packagename/files/packagename/screengrab/de-DE/images/screenshots C:/Users/USER/AppData/Local/Temp/d20201009-22720-woz01y
adb: error: failed to stat remote object '/data/data/packagename/files/packagename/screengrab/de-DE/images/screenshots': Permission denied
[12:58:21]: Exit status: 1
[12:58:21]: PERMISSION DENIED
[12:58:21]: $ adb -s emulator-5554 shell run-as packagename 'tar -cC /data/data/packagename/files/packagename/screengrab/de-DE/images screenshots' | tar -xvC C:/Users/USER/AppData/Local/Temp/d20201009-22720-woz01y
tar: Error opening archive: Failed to open '\.tape0'
run-as: exec failed for tar -cC /data/data/packagename/files/packagename/screengrab/de-DE/images screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/data/packagename/app_screengrab/de-DE/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/data/packagename/screengrab/de-DE/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/user/0/packagename/files/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/data/packagename/files/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/data/packagename/app_screengrab/en-US/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
ls: /data/data/packagename/screengrab/en-US/images/screenshots: No such file or directory
[12:58:21]: Exit status: 1
[12:58:21]: Make sure you've used Screengrab.screenshot() in your tests and that your expected tests are being run.
[!] No screenshots were detected 📷❌
[12:58:21]: WARNING: fastlane requires your locale to be set to UTF-8. To learn more go to https://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables

尝试使用相当于30.0.x和类似版本的android构建工具,以便与API版本30兼容。

尝试在src/debug/AndroidManifest.xml中添加这些

<!-- Allows unlocking your device and activating its screen so UI tests can succeed -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Allows for storing and retrieving screenshots -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Allows changing locales -->
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />

相关内容

  • 没有找到相关文章

最新更新