Don’t confuse Gradle versions with Android Gradle Plugin versions.
The latest Gradle version is 8.0.1.
But the latest Android Gradle Plugin version is 7.4.2.
Again, you did not change the Gradle version, you changed the version of the Android Gradle Plugin.
But what Gradle version are you using? I guess something below 7.6. Because your message now says that you want to use Java 19 stuff with something that is not compatible with Java 19 like Gradle versions below 7.6: Compatibility Matrix
So if my assumption is right, either use an older Java version that is supported, or use a newer Gradle version.
yes, thank you, that worked now! But now I got this mistake. Could you help me there please?
A build operation failed.
Could not resolve all files for configuration ‘:path_provider_android:androidApis’.
Could not resolve all files for configuration ‘:path_provider_android:androidApis’.
Failed to transform android.jar to match attributes {artifactType=android-mockable-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=true}.
Execution failed for MockableJarTransform: C:\Users\finni\AppData\Local\Android\sdk\platforms\android-31\android.jar.
Cannot create mockable android.jar
C:\Users\finni\AppData\Local\Android\sdk\platforms\android-31\android.jar
No, I have no idea about Android.
You might better ask in some Android community about it.
And you might check whether --info and --stacktrace maybe give more information about the problem.