我正在尝试在 Nexus 5X API 26 模拟器中执行命令fastlane screengrab 。
这是我得到的结果:
rcarba$ fastlane screengrab
[✔]
[16:00:51]: fastlane detected a Gemfile in the current directory
[16:00:51]: however it seems like you don't use `bundle exec`
[16:00:51]: to launch fastlane faster, please use
[16:00:51]:
[16:00:51]: $ bundle exec fastlane screengrab
[16:00:51]:
[16:00:51]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[16:00:51]: Successfully loaded '/Users/.../fastlane/Screengrabfile'
+----------------------------+-----------------------------------------------+
| Detected Values from './fastlane/Screengrabfile' |
+----------------------------+-----------------------------------------------+
| app_package_name | com.my.app |
| app_apk_path | app/build/outputs/apk/release/app-release.apk |
| tests_apk_path | app/build/outputs/apk/debug/app-debug.apk |
| locales | ["en-US"] |
| clear_previous_screenshots | true |
+----------------------------+-----------------------------------------------+
[16:00:51]: Using `adb` found at /Users/.../Library/Android/sdk/platform-tools/adb which is not within the specified ANDROID_HOME at ~/Library/Android/sdk/
[16:00:51]: The `aapt` command could not be found relative to your provided ANDROID_HOME at ~/Library/Android/sdk/
[16:00:51]: Please ensure that the Android SDK is installed and you have the build tools downloaded
+-----------------------------+------------------------------------------------+
| Summary for screengrab 2.103.1 |
+-----------------------------+------------------------------------------------+
| tests_package_name | com.my.app.test |
| android_home | ~/Library/Android/sdk/ |
| locales | ["en-US"] |
| clear_previous_screenshots | true |
| output_directory | fastlane/metadata/android |
| skip_open_summary | false |
| app_package_name | com.my.app |
| test_instrumentation_runner | android.support.test.runner.AndroidJUnitRunner |
| ending_locale | en-US |
| app_apk_path | app/build/outputs/apk/release/app-release.apk |
| tests_apk_path | app/build/outputs/apk/debug/app-debug.apk |
| device_type | phone |
| exit_on_test_failure | true |
| reinstall_app | false |
+-----------------------------+------------------------------------------------+
[16:00:51]: Limiting the test classes run by `screengrab` to just those that generate screenshots can make runs faster.
[16:00:51]: Consider using the :use_tests_in_classes or :use_tests_in_packages option, and organize your tests accordingly.
[16:00:51]: Clearing phoneScreenshots within fastlane/metadata/android
[16:00:51]: $ /Users/.../Library/Android/sdk/platform-tools/adb devices -l
[16:00:51]: ▸ List of devices attached
[16:00:51]: ▸ emulator-5554 device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:2
[16:00:51]: $ /Users/.../Library/Android/sdk/platform-tools/adb -s emulator-5554 shell echo \$EXTERNAL_STORAGE
[16:00:51]: ▸ /sdcard
[16:00:51]: Cleaning screenshots on device
ls: /sdcard/com.my.App/screengrab: No such file or directory
[16:00:51]: Exit status: 1
ls: /data/data/com.my.App/app_screengrab: No such file or directory
[16:00:52]: Exit status: 1
[16:00:52]: The `aapt` command could not be found on your system, so your app APK could not be validated
[16:00:52]: Installing app APK
[16:00:52]: $ /Users/.../Library/Android/sdk/platform-tools/adb -s emulator-5554 install -t -r app/build/outputs/apk/release/app-release.apk
[16:01:00]: ▸ Success
[16:01:00]: Installing tests APK
[16:01:00]: $ /Users/.../Library/Android/sdk/platform-tools/adb -s emulator-5554 install -t -r app/build/outputs/apk/debug/app-debug.apk
[16:01:06]: ▸ Success
[16:01:06]: Granting the permission necessary to change locales on the device
[16:01:06]: $ /Users/.../Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm grant com.skitude.AllegheUP android.permission.CHANGE_CONFIGURATION
[16:01:07]: ▸ Operation not allowed: java.lang.SecurityException: Package com.my.App has not requested permission android.permission.CHANGE_CONFIGURATION
Operation not allowed: java.lang.SecurityException: Package com.my.App has not requested permission android.permission.CHANGE_CONFIGURATION
[16:01:07]: Exit status: 1
[!] Exit status: 1
rcarba$
这是由于在 AndroidManifest.xml 文件中没有适当的权限而通常会发生的问题,但是当我添加它时,不仅我得到了同样的错误,而且 AndroidManifest.xml 似乎也在抱怨: Android Manifest Error
所以我试图添加出现在这个线程中的这一行:Permission is only grant to system app
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
tools:ignore="ProtectedPermissions" />
但结果保持不变。
任何人都知道什么会导致该错误?