I'm trying to execute the command fastlane screengrab in a Nexus 5X API 26 emulator.
This is the result I get:
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$
This is a problem that normally happens for not having the proper permission in the AndroidManifest.xml file, but when I add it, not only I get the same error, but also the AndroidManifest.xml seems to complain about that: Android Manifest Error
So I tried to add this line that appears in this thread: Permission is only granted to system app
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
tools:ignore="ProtectedPermissions" />
but the results remain the same.
Anybody has a clue of what can cause that error?