我正在尝试在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 granted to system app
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
tools:ignore="ProtectedPermissions" />
,但结果保持不变。
任何人都有什么线索可以导致该错误?
答案 0 :(得分:1)
好的,只需构建一个新的调试apk即可,我希望它对某人有帮助:)
更新: 现在,我对它有了更多的了解,这可能是因为当我执行该命令时,它总是使用相同的调试apk,并且与我对androidManifest所做的更改无关紧要。 一旦我构建了新的调试apk,androidManifest的所有更改就都移到了构建中,然后就可以了。