mmcc007 / sylph

Runs Flutter integration tests on real devices in cloud.
GNU General Public License v3.0
157 stars 43 forks source link

flavors launch wrong Android package #107

Open kirill09 opened 4 years ago

kirill09 commented 4 years ago

If the project uses flavors on aws launches invalid Android package ` [DEVICEFARM] Setting up your device. This usually takes 2-3 minutes. [DEVICEFARM] ########### Start executing testspec ###########

[DEVICEFARM] ########### Entering phase install ###########

[DeviceFarm] cd flutter_app [DeviceFarm] ls -la total 156 drwxrwxrwx 16 rwx rwx 4096 May 25 08:41 . drwxrwxrwx 9 rwx rwx 4096 May 25 08:41 .. -rwxrwxrwx 1 rwx rwx 2805 May 25 08:41 analysis_options.yaml drwxrwxrwx 8 rwx rwx 4096 May 25 08:41 android drwxrwxrwx 5 rwx rwx 4096 May 25 08:41 assets -rwxrwxrwx 1 rwx rwx 47 May 25 08:41 build_to_os.txt drwxrwxrwx 3 rwx rwx 4096 May 25 08:41 .dart_tool -rwxrwxrwx 1 rwx rwx 10244 May 25 08:41 .DS_Store -rwxrwxrwx 1 rwx rwx 210 May 25 08:41 .editorconfig -rwxrwxrwx 1 rwx rwx 2711 May 25 08:41 .flutter-plugins -rwxrwxrwx 1 rwx rwx 1500 May 25 08:41 .flutter-plugins-dependencies drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 fonts drwxrwxrwx 5 rwx rwx 4096 May 25 08:41 .git -rwxrwxrwx 1 rwx rwx 1733 May 25 08:41 .gitignore drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 icons drwxrwxrwx 4 rwx rwx 4096 May 25 08:41 .idea drwxrwxrwx 9 rwx rwx 4096 May 25 08:41 ios drwxrwxrwx 3 rwx rwx 4096 May 25 08:41 lib -rwxrwxrwx 1 rwx rwx 305 May 25 08:41 .metadata -rwxrwxrwx 1 rwx rwx 12705 May 25 08:41 .packages -rwxrwxrwx 1 rwx rwx 1810 May 25 08:41 patch.diff -rwxrwxrwx 1 rwx rwx 20186 May 25 08:41 pubspec.lock -rwxrwxrwx 1 rwx rwx 3426 May 25 08:41 pubspec.yaml -rwxrwxrwx 1 rwx rwx 531 May 25 08:41 README.md drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 screenshots drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 script -rwxrwxrwx 1 rwx rwx 932 May 25 08:41 sylph.yaml drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 test drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 test_driver drwxrwxrwx 2 rwx rwx 4096 May 25 08:41 .vscode [DeviceFarm] bash --version GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [DeviceFarm] echo "DEVICEFARM_APP_PATH=$DEVICEFARM_APP_PATH" DEVICEFARM_APP_PATH=/tmp/scratchVgiclt.scratch/share-h4u8ep.scratch/app-XoTekz.apk [DeviceFarm] echo "Install flutter" Install flutter [DeviceFarm] FLUTTER_VERSION=v1.12.13+hotfix.8-stable [DeviceFarm] if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "Android" ]; then

Install Flutter

curl https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_$FLUTTER_VERSION.tar.xz -o flutter_linux.tar.xz
tar xf flutter_linux.tar.xz

fi if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "iOS" ]; then

Install Flutter

curl https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_$FLUTTER_VERSION.zip -o flutter_macos.zip
unzip -qq flutter_macos.zip

fi % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 4 485M 4 23.6M 0 0 25.5M 0 0:00:19 --:--:-- 0:00:19 25.5M 16 485M 16 78.0M 0 0 40.4M 0 0:00:12 0:00:01 0:00:11 40.4M 27 485M 27 133M 0 0 45.7M 0 0:00:10 0:00:02 0:00:08 45.6M 37 485M 37 184M 0 0 46.8M 0 0:00:10 0:00:03 0:00:07 46.8M 48 485M 48 233M 0 0 47.2M 0 0:00:10 0:00:04 0:00:06 47.2M 58 485M 58 283M 0 0 47.7M 0 0:00:10 0:00:05 0:00:05 51.8M 65 485M 65 315M 0 0 45.5M 0 0:00:10 0:00:06 0:00:04 47.5M 72 485M 72 349M 0 0 44.0M 0 0:00:11 0:00:07 0:00:04 43.0M 78 485M 78 381M 0 0 42.7M 0 0:00:11 0:00:08 0:00:03 39.5M 85 485M 85 415M 0 0 41.7M 0 0:00:11 0:00:09 0:00:02 36.3M 92 485M 92 447M 0 0 40.9M 0 0:00:11 0:00:10 0:00:01 32.8M 98 485M 98 480M 0 0 40.2M 0 0:00:12 0:00:11 0:00:01 32.9M 100 485M 100 485M 0 0 40.2M 0 0:00:12 0:00:12 --:--:-- 32.9M [DeviceFarm] mv flutter $HOME/flutter [DeviceFarm] export PATH=$PATH:$HOME/flutter/bin:$HOME/flutter/bin/cache/dart-sdk/bin [DeviceFarm] export PATH="$PATH":"$HOME/.pub-cache/bin" [DeviceFarm] flutter doctor -v Warning! This package referenced a Flutter repository via the .packages file that is no longer available. The repository from which the 'flutter' tool is currently executing will be used instead. running Flutter tool: /home/device-farm/flutter previous reference : /Users/kirillbelyshev/development_flutter/flutter This can happen if you deleted or moved your copy of the Flutter repository, or if it was on a volume that is no longer mounted or has been mounted at a different location. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path).

╔════════════════════════════════════════════════════════════════════════════╗ ║ A new version of Flutter is available! ║ ║ ║ ║ To update to the latest version, run "flutter upgrade". ║ ╚════════════════════════════════════════════════════════════════════════════╝

╔════════════════════════════════════════════════════════════════════════════╗ ║ Welcome to Flutter! - https://flutter.dev ║ ║ ║ ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║ ║ statistics and basic crash reports. This data is used to help improve ║ ║ Flutter tools over time. ║ ║ ║ ║ Flutter tool analytics are not sent on the very first run. To disable ║ ║ reporting, type 'flutter config --no-analytics'. To display the current ║ ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out ║ ║ event will be sent, and then no further information will be sent by the ║ ║ Flutter tool. ║ ║ ║ ║ By downloading the Flutter SDK, you agree to the Google Terms of Service. ║ ║ Note: The Google Privacy Policy describes how data is handled in this ║ ║ service. ║ ║ ║ ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and ║ ║ crash reports to Google. ║ ║ ║ ║ Read about data we send with crash reports: ║ ║ https://github.com/flutter/flutter/wiki/Flutter-CLI-crash-reporting ║ ║ ║ ║ See Google's privacy policy: ║ ║ https://www.google.com/intl/en/policies/privacy/ ║ ╚════════════════════════════════════════════════════════════════════════════╝

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8) • Flutter version 1.12.13+hotfix.8 at /home/device-farm/flutter • Framework revision 0b8abb4724 (3 months ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 21.1.1) • Android SDK at /opt/dev/android-sdk-linux • Android NDK location not configured (optional; useful for native profiling support) ✗ Flutter requires Android SDK 28 and the Android BuildTools 28.0.3 To update using sdkmanager, run: "/opt/dev/android-sdk-linux/tools/bin/sdkmanager" "platforms;android-28" "build-tools;28.0.3" or visit https://flutter.dev/setup/#android-setup for detailed instructions. ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[✓] Connected device (1 available) • Pixel 2 • FA79Y1A00660 • android-arm64 • Android 8.0.0 (API 26)

! Doctor found issues in 2 categories.

[DEVICEFARM] ########### Entering phase pre_test ###########

[DEVICEFARM] ########### Entering phase test ###########

[DeviceFarm] TEST_PHASE_STATUS=0 [DeviceFarm] track_test_phase_status() { local command_exit_code=$? if [ "$command_exit_code" != "0" ]; then echo "Most recent command failed with error code: $command_exit_code" TEST_PHASE_STATUS=$command_exit_code fi } set_test_phase_exit_code() { return $TEST_PHASE_STATUS } [DeviceFarm] echo "Navigate to test package directory" Navigate to test package directory [DeviceFarm] cd $DEVICEFARM_TEST_PACKAGE_PATH [DeviceFarm] echo "Start Flutter integration test" Start Flutter integration test [DeviceFarm] cd flutter_app [DeviceFarm] rm -f .packages [DeviceFarm] MAIN=test_driver/main.dart [DeviceFarm] TESTS=test_driver/main_test.dart [DeviceFarm] if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "Android" ]; then ./script/test_android.sh --run-tests "$TESTS" track_test_phase_status fi if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "iOS" ]; then ./script/test_ios.sh --unpack $DEVICEFARM_APP_PATH track_test_phase_status ./script/test_ios.sh --dummy-symbols build_to_os.txt track_test_phase_status ./script/test_ios.sh --run-tests "$MAIN" "$TESTS" track_test_phase_status fi Starting Flutter app ru.test.app '.dev' '.devp' in debug mode... Running "flutter pub get" in flutter_app... 24.3s Android Debug Bridge version 1.0.32 /system/bin/sh: '.dev': not found /system/bin/sh: '.devp': not found Starting: Intent { act=android.intent.action.RUN flg=0x20000000 pkg=ru.test.app (has extras) } Error: Activity not started, unable to resolve Intent { act=android.intent.action.RUN flg=0x30000000 pkg=ru.test.app (has extras) } /system/bin/sh: '.dev': not found /system/bin/sh: '.devp'/.MainActivity: not found Terminated [DEVICEFARM] ########### Stop received, exit testspec execution ########### [DEVICEFARM] ########### Finish executing testspec ###########

[DEVICEFARM] ########### Setting upload permissions ###########

chmod: cannot access ‘/tmp/customer_log_directorylbVP_F/*’: No such file or directory

[DEVICEFARM] Tearing down your device. Your tests report will come shortly. `

build.gradle ` android { compileSdkVersion 28

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    applicationId "ru.test.app"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
productFlavors {
    production {
        signingConfig signingConfigs.release
    }
    development {
        applicationIdSuffix '.dev'
        signingConfig signingConfigs.debug
    }
    devp {
        applicationIdSuffix '.devp'
        signingConfig signingConfigs.debug
    }
}

} `

The correct package name to launch ru.test.app.dev or ru.test.app.devp

philliping commented 4 years ago

@kirill09 any luck with this? I see you have on open PR, but the build is failing

I'm experiencing a similar problem when launching the test on AWS. My app has 3 flavors, each with distinct application ids