Раньше был use_adb_root параметр для Fastlane, но сейчас он устарел и не работает ни в одной версии, начиная с 2.0
[20:55:07]: Pulling captured screenshots from the device
ls: /sdcard/io.outright.my_flutter_app/screengrab: No such file or directory
[20:55:07]: Exit status: 1
ls: /data/data/io.outright.my_flutter_app/app_screengrab: Permission denied
[20:55:07]: Exit status: 1
[20:55:07]: Make sure you've used Screengrab.screenshot() in your tests and that your expected tests are being run.
Примечание: я на 100 % подтвердил, что использую Screengrab.screenshot() в своих тестах и мои ожидаемые тесты выполняются.
< strong>Screengrabfile
app_package_name('io.outright.my_flutter_app')
use_tests_in_packages(['io.outright.my_flutter_app'])
tests_package_name('io.outright.my_flutter_app.test')
app_apk_path('../build/app/outputs/apk/debug/app-debug.apk')
tests_apk_path('../build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk')
test_instrumentation_runner 'androidx.test.runner.AndroidJUnitRunner'
locales(['en-US'])
clear_previous_screenshots(true)
Fastfile
default_platform(:android)
platform :android do
desc "Capture screenshots"
lane :screenshots do
sh("flutter", "build", "apk", "--debug", "--dart-define=DEMO=true")
build_android_app(
task: 'assemble',
build_type: 'AndroidTest'
)
capture_android_screenshots
end
end
Журналы
$ bundle exec fastlane screenshots
[✔]
+-----------------------------------------------------------------------------------------------------+
| Used plugins |
+------------------------------------+---------+------------------------------------------------------+
| Plugin | Version | Action |
+------------------------------------+---------+------------------------------------------------------+
| fastlane-plugin-versioning_android | 0.1.1 | android_get_version_code, android_get_version_name, |
| | | android_set_version_code, android_set_version_name |
+------------------------------------+---------+------------------------------------------------------+
[20:54:38]: ------------------------------
[20:54:38]: --- Step: default_platform ---
[20:54:38]: ------------------------------
[20:54:38]: Driving the lane 'android screenshots'
[20:54:38]: -----------------------------------------------------------------
[20:54:38]: --- Step: flutter build apk --debug --dart-define\=DEMO\=true ---
[20:54:38]: -----------------------------------------------------------------
[20:54:38]: $ flutter build apk --debug --dart-define\=DEMO\=true
[20:54:38]: ▸ Changing current working directory to: /Users/kaye375751/om/StarHarvesterZero
[20:54:45]: ▸ Running Gradle task 'assembleDebug'... 5.0s
[20:54:46]: ▸ ✓ Built build/app/outputs/flutter-apk/app-debug.apk
[20:54:46]: ---------------------------------
[20:54:46]: --- Step: assembleAndroidTest ---
[20:54:46]: ---------------------------------
[20:54:46]: $ /Users/kaye375751/om/StarHarvesterZero/android/gradlew assembleAndroidTest -p .
[20:54:47]: ▸ > Task :gradle:compileJava NO-SOURCE
[20:54:47]: ▸ > Task :gradle:compileGroovy UP-TO-DATE
[20:54:47]: ▸ > Task :gradle:pluginDescriptors UP-TO-DATE
[20:54:47]: ▸ > Task :gradle:processResources UP-TO-DATE
[20:54:47]: ▸ > Task :gradle:classes UP-TO-DATE
[20:54:47]: ▸ > Task :gradle:jar UP-TO-DATE
.........many Gradle tasks.........
[20:54:50]: ▸ BUILD SUCCESSFUL in 4s
[20:54:50]: ▸ 280 actionable tasks: 1 executed, 279 up-to-date
[20:54:50]: Couldn't find any new signed apk files...
[20:54:50]: -----------------------------------------
[20:54:50]: --- Step: capture_android_screenshots ---
[20:54:50]: -----------------------------------------
[20:54:50]: Successfully loaded '/Users/kaye375751/om/StarHarvesterZero/android/fastlane/Screengrabfile'
+----------------------------------------------------------------------------------------------------+
| Detected Values from './fastlane/Screengrabfile' |
+-----------------------------+----------------------------------------------------------------------+
| app_package_name | io.outright.my_flutter_app |
| use_tests_in_packages | ["io.outright.my_flutter_app"] |
| tests_package_name | io.outright.my_flutter_app.test |
| app_apk_path | ../build/app/outputs/apk/debug/app-debug.apk |
| tests_apk_path | ../build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk |
| test_instrumentation_runner | androidx.test.runner.AndroidJUnitRunner |
| locales | ["en-US"] |
| clear_previous_screenshots | true |
+-----------------------------+----------------------------------------------------------------------+
[20:54:50]: The `aapt` command could not be found relative to your provided ANDROID_HOME at /Users/kaye375751/Library/Android/sdk
[20:54:50]: Please ensure that the Android SDK is installed and you have the build tools downloaded
+----------------------------------------------------------------------------------------------------+
| Summary for screengrab 1.0.0 |
+-----------------------------+----------------------------------------------------------------------+
| android_home | /Users/kaye375751/Library/Android/sdk |
| locales | ["en-US"] |
| clear_previous_screenshots | true |
| output_directory | fastlane/metadata/android |
| skip_open_summary | false |
| app_package_name | io.outright.my_flutter_app |
| tests_package_name | io.outright.my_flutter_app.test |
| use_tests_in_packages | ["io.outright.my_flutter_app"] |
| test_instrumentation_runner | androidx.test.runner.AndroidJUnitRunner |
| ending_locale | en-US |
| app_apk_path | ../build/app/outputs/apk/debug/app-debug.apk |
| tests_apk_path | ../build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk |
| device_type | phone |
+-----------------------------+----------------------------------------------------------------------+
[20:54:50]: Clearing phoneScreenshots within fastlane/metadata/android
[20:54:50]: $ adb devices -l
[20:54:51]: ▸ List of devices attached
[20:54:51]: ▸ emulator-5554 device product:sdk_gphone64_arm64 model:sdk_gphone64_arm64 device:emu64a transport_id:2
[20:54:51]: $ adb -s emulator-5554 shell echo \$EXTERNAL_STORAGE
[20:54:51]: ▸ /sdcard
[20:54:51]: Cleaning screenshots on device
ls: /sdcard/io.outright.my_flutter_app/screengrab: No such file or directory
[20:54:51]: Exit status: 1
ls: /data/data/io.outright.my_flutter_app/app_screengrab: No such file or directory
[20:54:51]: Exit status: 1
[20:54:51]: The `aapt` command could not be found on your system, so your app APK could not be validated
[20:54:51]: Installing app APK
[20:54:51]: $ adb -s emulator-5554 install -r ../build/app/outputs/apk/debug/app-debug.apk
[20:54:51]: ▸ Performing Streamed Install
[20:54:52]: ▸ Success
[20:54:52]: Installing tests APK
[20:54:52]: $ adb -s emulator-5554 install -r ../build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk
[20:54:52]: ▸ Performing Streamed Install
[20:54:52]: ▸ Success
[20:54:52]: Granting the permission necessary to change locales on the device
[20:54:52]: $ adb -s emulator-5554 shell pm grant io.outright.my_flutter_app android.permission.CHANGE_CONFIGURATION
[20:54:52]: $ adb -s emulator-5554 shell getprop ro.build.version.sdk
[20:54:52]: ▸ 34
[20:54:52]: Granting the permissions necessary to access device external storage
[20:54:52]: $ adb -s emulator-5554 shell pm grant io.outright.my_flutter_app android.permission.WRITE_EXTERNAL_STORAGE
[20:54:52]: $ adb -s emulator-5554 shell pm grant io.outright.my_flutter_app android.permission.READ_EXTERNAL_STORAGE
[20:54:52]: Running tests for locale: en-US
[20:54:52]: $ adb -s emulator-5554 shell am instrument --no-window-animation -w \
-e testLocale en_US \
-e endingLocale en_US \
-e package io.outright.my_flutter_app \
io.outright.my_flutter_app.test/androidx.test.runner.AndroidJUnitRunner
[20:55:00]: ▸ io.outright.my_flutter_app.ScreengrabTest:s_glBindAttribLocation: bind attrib 0 name position
[20:55:00]: ▸ s_glBindAttribLocation: bind attrib 1 name color
[20:55:00]: ▸ s_glBindAttribLocation: bind attrib 2 name localCoord
[20:55:07]: ▸ .
[20:55:07]: ▸ Time: 13.232
[20:55:07]: ▸ OK (1 test)
[20:55:07]: Pulling captured screenshots from the device
ls: /sdcard/io.outright.my_flutter_app/screengrab: No such file or directory
[20:55:07]: Exit status: 1
ls: /data/data/io.outright.my_flutter_app/app_screengrab: Permission denied
[20:55:07]: Exit status: 1
[20:55:07]: Make sure you've used Screengrab.screenshot() in your tests and that your expected tests are being run.
+-----------------------------------------------------------+
| Lane Context |
+-------------------------------------+---------------------+
| DEFAULT_PLATFORM | android |
| PLATFORM_NAME | android |
| LANE_NAME | android screenshots |
| GRADLE_BUILD_TYPE | AndroidTest |
| GRADLE_ALL_APK_OUTPUT_PATHS | [] |
| GRADLE_ALL_AAB_OUTPUT_PATHS | [] |
| GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS | [] |
| GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS | [] |
+-------------------------------------+---------------------+
[20:55:07]: Called from Fastfile at line 62
[20:55:07]: ```
[20:55:07]: 60: build_type: 'AndroidTest'
[20:55:07]: 61: )
[20:55:07]: => 62: capture_android_screenshots
[20:55:07]: 63: upload_to_play_store
[20:55:07]: 64: end
[20:55:07]: ```
[20:55:07]: No screenshots were detected
+--------------------------------------------------------------------------+
| fastlane summary |
+------+-----------------------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+-----------------------------------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | flutter build apk --debug --dart-define\=DEMO\=true | 7 |
| 3 | assembleAndroidTest | 4 |
|
+------+-----------------------------------------------------+-------------+
[20:55:07]: fastlane finished with errors
[!] No screenshots were detected
Подробнее здесь: https://stackoverflow.com/questions/792 ... he-emulato
Мобильная версия