1

Getting below build errors when i use below patrol cli command to run test

patrol test --target integration_test/example_test.dart

**Build error 1 - Execution failed for task ':video_player_android:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.

Build error 2 - * What went wrong: java.lang.StackOverflowError (no error message)**

Below is the code

void main() {
  patrolTest('demo', nativeAutomation: true, (PatrolTester $) async {
    await $.pumpWidgetAndSettle(AwesomeApp());
    // prepare network conditions
    await $.native.enableCellular();
    await $.native.disableWifi();

    // toggle system theme
    await $.native.enableDarkMode();

    // handle native location permission request dialog
    await $.native.selectFineLocation();
    await $.native.grantPermissionWhenInUse();

    // tap on the first notification
    await $.native.openNotifications();
    await $.native.tapOnNotificationByIndex(0);
  });
}

Build should be successful and should be able to run the test successfully.

3
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jun 13, 2023 at 9:38
  • Provided code for more reference Commented Jun 13, 2023 at 12:41
  • I am facing the same problem today. Here is my error log bash 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':geolocator_android:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. 2: Task failed with an exception. ----------- * What went wrong: java.lang.StackOverflowError (no error message) Commented Jun 18, 2023 at 12:40

1 Answer 1

1

This is happening for incompatible gradle and java versions.

To check the versions try cd android && ./gradlew -v

------------------------------------------------------------
Gradle 7.5.1 # This version has to be supported by the JVM version below
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.x.x # or 11.x.x or 8.x.x
OS:           Mac OS X 13.4 aarch64

Now, install the correct jvm and set it up in .zshrc or .bashrc file

  1. Find out the correct jdk for your gradle version; say it is openjdk@17
  2. Install JVM (openjdk@17)
    brew install openjdk@17
    # follow instructions for symbolic linking in the terminal 
    
  3. Setup environment variables
    export JAVA_HOME="/opt/homebrew/opt/openjdk@17"
    export PATH="$JAVA_HOME/bin:$PATH"
    
  4. Source your .rc file
    source ~/.zshrc # or ~/.bashrc
    
  5. Reopen vscode or android studio or vim for the updated config to take effect
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.