Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run the Android integration tests #1661

Closed
vlazdra opened this issue Aug 24, 2023 · 7 comments
Closed

Unable to run the Android integration tests #1661

vlazdra opened this issue Aug 24, 2023 · 7 comments
Assignees

Comments

@vlazdra
Copy link

vlazdra commented Aug 24, 2023

Steps to reproduce

I'm trying to run a very simple Android integration test, but can't seam to pass the build process of the actual APK. The log output has been added bellow. I'm trying to run it on a physical device if that's of any value.

This is the command I'm trying to use:
patrol test --debug --flavor development --target integration_test/app_test.dart --verbose

Note: Unfortunately I can't share the project source code as it's private and proprietary.

Regarding the setup of the Android part I've added this as per the documentation to the defaultConfig:

testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"

I've added this as well to the android block

testOptions {
    execution "ANDROIDX_TEST_ORCHESTRATOR"
}

As well as the dependencies:

dependencies {
    androidTestUtil "androidx.test:orchestrator:1.4.2"
}

Actual results

The build fails with the logs as described bellow.

Logs

Logs
 patrol test --debug --flavor development --target integration_test/app_test.dart --verbose

Verbose mode enabled. More logs will be printed.
Received 1 test target(s)
Received test target: /Users/vlazdra/Documents/Projects/[hidden]/integration_test/app_test.dart
Generated entrypoint /Users/vlazdra/Documents/Projects/[hidden]/integration_test/test_bundle.dart with 1 bundled test(s)
Received Android flavor: development
Received iOS flavor: development
$ flutter --no-version-check devices --machine
No device specified, using the first one (2c76a036)
Received 1 device(s) to run on
Received device: 2c76a036
Received 7 --dart-define(s) (0 custom, 7 internal)
Received internal --dart-define: PATROL_WAIT=0
Received internal --dart-define: PATROL_APP_PACKAGE_NAME=[hidden]
Received internal --dart-define: PATROL_APP_BUNDLE_ID=[hidden]
Received internal --dart-define: PATROL_ANDROID_APP_NAME=[hidden]
Received internal --dart-define: PATROL_IOS_APP_NAME=[hidden]
Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false
Received internal --dart-define: PATROL_TEST_LABEL_ENABLED=true
• Building apk with entrypoint test_bundle.dart...
$ ./gradlew :app:assembleDevelopmentDebug -Ptarget=/Users/vlazdra/Documents/Projects/[hidden]/integration_test/test_bundle.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9cnMuYWJzdHJhYy5maXRwYXNzLmRldg==,UEFUUk9MX0FQUF9CVU5ETEVfSUQ9cnMuYWJzdHJhYy5maXRwYXNzLmRldjE=,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9Rml0cGFzcyBERVY=,UEFUUk9MX0lPU19BUFBfTkFNRT1GaXRwYXNzIERFVg==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl,UEFUUk9MX1RFU1RfTEFCRUxfRU5BQkxFRD10cnVl
        : > Task :app:preBuild UP-TO-DATE
        : > Task :app:preDevelopmentDebugBuild UP-TO-DATE
...
...
...
        : > Task :permission_handler_android:copyDebugJniLibsProjectOnly UP-TO-DATE
        : 
        : > Task :patrol:compileDebugKotlin
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:20:37 Unresolved reference: nativeView
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:21:37 Unresolved reference: notification
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:25:12 Unresolved reference: nativeView
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:27:13 Unresolved reference: className
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:31:13 Unresolved reference: text
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:35:13 Unresolved reference: contentDescription
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:38:9 Unresolved reference: focused
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:39:9 Unresolved reference: enabled
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:40:9 Unresolved reference: childCount
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:43:13 Unresolved reference: resourceName
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:47:13 Unresolved reference: applicationPackage
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:50:9 Unresolved reference: children
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:337:32 Unresolved reference: notification
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:340:26 Unresolved reference: appName
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:346:26 Unresolved reference: title
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/Automator.kt:355:26 Unresolved reference: content
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:12:37 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:13:37 Unresolved reference: getNativeViewsResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:14:37 Unresolved reference: getNotificationsResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:15:37 Unresolved reference: permissionDialogVisibleResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:23:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:28:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:33:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:38:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:43:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:48:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:53:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:58:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:63:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:68:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:73:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:78:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:83:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:88:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:93:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:98:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:103:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:108:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:113:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:118:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:123:16 Unresolved reference: getNativeViewsResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:123:41 Unresolved reference: nativeViews
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:128:16 Unresolved reference: getNotificationsResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:128:43 Unresolved reference: notifications
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:138:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:148:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:170:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:181:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:190:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:195:16 Unresolved reference: permissionDialogVisibleResponse
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:195:55 Unresolved reference: visible
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:205:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:214:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:223:16 Unresolved reference: empty
        e: file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol-2.2.3/android/src/main/kotlin/pl/leancode/patrol/AutomatorServer.kt:228:16 Unresolved reference: empty
        : 
        : > Task :patrol:compileDebugKotlin FAILED
        : 
        : > Task :rive_common:configureCMakeDebug[arm64-v8a]
        : C/C++: CMake Warning (dev) in CMakeLists.txt:
        : C/C++:   No project() command is present.  The top-level CMakeLists.txt file must
        : C/C++:   contain a literal, direct call to the project() command.  Add a line of
        : C/C++:   code such as
        : C/C++:     project(ProjectName)
        : C/C++:   near the top of the file, but after cmake_minimum_required().
        : C/C++:   CMake is pretending there is a "project(Project)" command on the first
        : C/C++:   line.
        : C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':patrol:compileDebugKotlin'.
        > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
           > Compilation error. See log for more details

        * Try:
        > Run with --stacktrace option to get the stack trace.
        > Run with --info or --debug option to get more log output.
        > Run with --scan to get full insights.

        * Get more help at https://help.gradle.org

        BUILD FAILED in 10s
        : 623 actionable tasks: 6 executed, 617 up-to-date
✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 1) (11.3s)
Exception: Gradle build failed with code 1
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
<asynchronous suspension>
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)
<asynchronous suspension>
#2      AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)
<asynchronous suspension>
#3      TestCommand._build (package:patrol_cli/src/commands/test.dart:230:7)
<asynchronous suspension>
#4      TestCommand.run (package:patrol_cli/src/commands/test.dart:167:5)
<asynchronous suspension>
#5      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#6      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:320:18)
<asynchronous suspension>
#7      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:264:18)
<asynchronous suspension>
#8      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:76:20)
<asynchronous suspension>
#9      main (file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol_cli-2.1.2/bin/main.dart:6:20)
<asynchronous suspension>

See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.
Exception: Gradle build failed with code 1
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
<asynchronous suspension>
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)
<asynchronous suspension>
#2      AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)
<asynchronous suspension>
#3      TestCommand._build (package:patrol_cli/src/commands/test.dart:230:7)
<asynchronous suspension>
#4      TestCommand.run (package:patrol_cli/src/commands/test.dart:167:5)
<asynchronous suspension>
#5      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#6      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:320:18)
<asynchronous suspension>
#7      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:264:18)
<asynchronous suspension>
#8      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:76:20)
<asynchronous suspension>
#9      main (file:///Users/vlazdra/.pub-cache/hosted/pub.dev/patrol_cli-2.1.2/bin/main.dart:6:20)
<asynchronous suspension>

Patrol version

patrol: 2.2.3

Patrol Doctor output

Patrol Doctor output
Patrol CLI version: 2.1.2
Program adb found in /Users/vlazdra/Library/Android/sdk/platform-tools//adb
Env var $ANDROID_HOME set to /Users/vlazdra/Library/Android/sdk
Program xcodebuild found in /usr/bin/xcodebuild
Program ideviceinstaller not found (install with `brew install ideviceinstaller`)

Flutter Doctor output

Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.1, on macOS 13.4.1 22F770820d darwin-arm64, locale en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2023.1.2)
[✓] VS Code (version 1.81.0)
[✓] VS Code (version 1.82.0-insider)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
@jBorkowska jBorkowska self-assigned this Aug 24, 2023
@jBorkowska
Copy link
Collaborator

Hi @vlazdra, just to confirm:

  • did you add the MainActivityTest.java file?
  • is your app building?

It looks a bit like this issue, but not exactly - you can try the workaround written there as well.

@vlazdra
Copy link
Author

vlazdra commented Aug 24, 2023

Hi @jBorkowska 🙌

Yes, I've added the MainActivityTest.java file inside the android/app/src/androidTest/java/com/example/app/ (for comment purposes I've added a fake package name, but it's changed as well)

Now that you mentioned it, I tried to build the app as per usual and it's no longer building with the same issue as described in the ticket. I'f I remove the patrol dependency inside the pubspec.yaml the project builds normally (which is to be expected I guess).

Also I already did the whole remove the pub-spec cache dir, still nothing.

@mateuszwojtczak
Copy link
Contributor

Hi @vlazdra! Can you share your build.gradle files? Or maybe your Kotlin version specified in top-level build.gradle file?

I'm thinking of something like a Kotlin version mismatch since those files that have unresolved references in your log are just generated proto contracts and they should just work 🤷

@vlazdra
Copy link
Author

vlazdra commented Aug 25, 2023

Hi @mateuszwojtczak thanks for the reply! 🙌

The kotlin version is 1.8.21

Here are the build gradle files:

Top level build.gradle
buildscript {
    ext.kotlin_version = '1.8.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.14'
        classpath 'com.google.firebase:perf-plugin:1.4.2'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

And this is the app level build gradle:

App level build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties")))

def projectSetupProperties = new Properties()
projectSetupProperties.load(new FileInputStream(rootProject.file("project_setup.properties")))

def dartEnvironmentVariables = [
    INTERCOM_KEY: project.hasProperty("INTERCOM_KEY") 
        ? INTERCOM_KEY
        : "",
    INTERCOM_ANDROID_KEY: project.hasProperty("INTERCOM_ANDROID_KEY")
        ? INTERCOM_ANDROID_KEY
        : ""
]

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    ndkVersion '25.1.8937393'
    compileSdkVersion 33

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
        }
        
        resValue "string", "intercom_key", dartEnvironmentVariables.INTERCOM_KEY
        resValue "string", "intercom_android_key", dartEnvironmentVariables.INTERCOM_ANDROID_KEY

        testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
        testInstrumentationRunnerArguments clearPackageData: "true"
    }

    testOptions {
        execution "ANDROIDX_TEST_ORCHESTRATOR"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }

        debug {
            storeFile file("../keys/debug.keystore")
            storePassword "android"
            keyAlias "androiddebugkey"
            keyPassword "android"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
        }

        debug {
            signingConfig signingConfigs.debug
            minifyEnabled false
        }
    }

    flavorDimensions "default"
    productFlavors {
        production {
            dimension "default"
            applicationId projectSetupProperties['applicationId']
            applicationIdSuffix ""
        }

        staging {
            dimension "default"
            applicationId projectSetupProperties['applicationId']
            applicationIdSuffix ".stg"
        }

        development {
            dimension "default"
            applicationId projectSetupProperties['applicationId']
            applicationIdSuffix ".dev"
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    androidTestUtil "androidx.test:orchestrator:1.4.2"
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.firebase.crashlytics'

@bartekpacia
Copy link
Contributor

Hi @vlazdra, try these commands (line by line, run from your project's root directory):

cd ./android && ./gradlew :clean && cd ..
rm -rf ./build
rm -rf ~/.gradle/caches
dart pub cache clean && flutter pub get
./gradlew --stop

@vlazdra
Copy link
Author

vlazdra commented Oct 11, 2023

I am able to build the project now, I think the only thing I did was change the version of patrol in the meantime.
We weren't using it for some time due to other priorities, so when I updated the version to the latest it started working.

Not sure if it was just the version bump or actually removing the entire cache. :/

Closing the ticket.

@vlazdra vlazdra closed this as completed Oct 11, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants