patrol icon indicating copy to clipboard operation
patrol copied to clipboard

First android build failed

Open zltnDC opened this issue 1 year ago • 10 comments

Steps to reproduce

  1. git checkout 827b11c764d63123259560e8546aab71b61c1470 - current master
  2. dart run /patrol/packages/patrol_cli/bin/main.dart test --verbose --target integration_test/example_test.dart

Actual results

Android test builds always failed with this error. Some solutions from the Internet didn't help, but the problem disappeared when I built the example app normally using "flutter run". This issue is similar to the other where we need to build our app at least once.

Logs

Logs
	FAILURE: Build failed with an exception.
	
	* What went wrong:
	A problem occurred configuring root project 'android'.
	> Could not open proj generic class cache for build file 'patrol/packages/patrol/example/android/build.gradle' (/.gradle/caches/7.6.2/scripts/7jd035x0svt1nqxqk95ifino8).
	   > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
	
	* 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 619ms
✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 1) (1.1s)

Patrol version

patrol: master == 827b11c764d63123259560e8546aab71b61c1470

Patrol Doctor output

Patrol Doctor output
You're using Patrol CLI 2.0, which has breaking changes.
Read the migration guide at https://patrol.leancode.co/v2.
Disable this warning by setting the PATROL_MIGRATED environment variable.

Patrol CLI version: 2.1.1
Program adb found in /Users/User/Library/Android/sdk/platform-tools/adb
Env var $ANDROID_HOME set to /Users/User/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
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-x64, locale pl-PL)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.81.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

zltnDC avatar Aug 30 '23 11:08 zltnDC

Can I take the Issue?

TSxSAHIL avatar Aug 30 '23 13:08 TSxSAHIL

Can you please brief that If you are trying to make bundle or apk what are the error's it is showing

TSxSAHIL avatar Aug 30 '23 13:08 TSxSAHIL

That's because Gradle wrapper doesn't exist until flutter build is executed.

We could fix this bug very easily by running flutter build apk --config-only before proceeding with gradlew invocations – but it's only available in Flutter 3.13 and newer.

bartekpacia avatar Sep 13 '23 06:09 bartekpacia

See also #1837 where a implementation idea was proposed

bartekpacia avatar Nov 09 '23 12:11 bartekpacia

I'll try to have a crack at this over the weekend.

bas-ie avatar Nov 10 '23 04:11 bas-ie

@richchurcher actually you can wait with it for our 3.0 release. We'll bump our min Flutter SDK version to the next stable Flutter then (the one that'll likely come out in November).

Then this task will become simpler, you won't even have to check for Flutter version. You will be able to call --config-only unconditionally.

bartekpacia avatar Nov 11 '23 11:11 bartekpacia

Oh good point, it'll be much easier to assume the version.

bas-ie avatar Nov 11 '23 18:11 bas-ie

We released 3.0 last week and our minimum Flutter version is 3.16 now. So this change should be quite easy.

bartekpacia avatar Nov 21 '23 11:11 bartekpacia

Nice! Unfortunately they broke debugging in 3.16 so I've had to move to 3.17 beta, but that shouldn't stop me from fixing this.

bas-ie avatar Nov 21 '23 20:11 bas-ie

Hello, I'm wondering if this has been fixed? I'm running into the same issue with CLI 2.2.2 and Patrol 2.3.2. I can't really upgrade to Flutter >3.13, so I wanted to ask if there's any workarounds in the meantime?

juanmanjarres avatar Feb 28 '24 20:02 juanmanjarres

Size: S

jBorkowska avatar Aug 05 '24 12:08 jBorkowska

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[bot] avatar Aug 14 '24 12:08 github-actions[bot]