juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 504 forks source link

[Android][Gradle] Can't build example project to android device #918

Closed Byambasurenn closed 3 months ago

Byambasurenn commented 5 months ago

Hello, I followed the instructions, looked at the similar issues bu no luck.

I got this error when I try to run flutter application:

  • Where: Build file 'H:\HEMAB\androidversion\flutter-unity-view-widget\example\android\build.gradle' line: 31

  • What went wrong: A problem occurred evaluating root project 'android'. A problem occurred configuring project ':app'. Could not open proj generic class cache for build file 'H:\HEMAB\androidversion\flutter-unity-view-widget\example\android\app\build.gradle' (C:\Users\byambaa.gradle\caches\6.5\scripts\4krocuxnh3ewjlr8r8o07tqsj\projb175e8fd9a0044c7af61444ba048d791). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 61

Steps to reproduce:

  1. Clone project
  2. Export Unity to android
  3. Add NDK path.
  4. Replace '/' with '//'
  5. Run -> Start Debugging

I think it's something to do with gradle and jdk version.

Please help me find solution for this!

timbotimbo commented 5 months ago

This is the kind of error you get if your java and gradle versions aren't compatible.

Can you try the versions that I applied in this pull request? gradle If those still don't work, maybe try updating your android studio.

timbotimbo commented 3 months ago

Flutter actually has a guide for this Unsupported class file major version 61 error, which also mentions updating the gradle version. https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide

You can fix this error by upgrading your Gradle project to a compatible version (7.3 through 7.6.1, inclusive)