juicycleff/flutter-unity-view-widget

No matching configuration of project :unityLibrary was found

mahammad-webelight opened this issue · 1 comments


Issue Description:

When trying to run the example app of https://pub.dev/packages/flutter_unity_widget, I encountered the following error during the build process:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve project :unityLibrary.
     Required by:
         project :app
         project :app > project :flutter_unity_widget
      > No matching configuration of project :unityLibrary was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.1.2', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

* 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 6s
Error: Gradle task assembleDebug failed with exit code 1

Exited (1).

Steps to Reproduce:

  1. Run the Flutter project with flutter run.
  2. Observe the build process and error message.

Expected Behavior:
The project should build and run successfully without any Gradle configuration issues.

Actual Behavior:
The build fails with the error message above.

Environment:

  • Flutter version: 3.22.0
  • Unity version: latest
  • Android Studio version: Android Studio Jellyfish | 2023.3.1
  • Gradle version: 7.4.0

Additional Context:
This issue seems to be related to the deprecated method of applying Flutter's Gradle plugins. Any guidance on resolving this issue would be appreciated.


The gradle apply method is just a warning, it does not throw or cause any errors.
Maybe you could run in to errors if you add modifications in the new style without upgrading the existing files.

The example uses Gradle 7.2 with AGP 7.1.2 because that is what Unity 2022.3.x is officially compatible with.
You can use higher gradle versions, but that requires manually changing files like gradle-wrapper.properties and build.gradle.

Which files did you change to configure Gradle 8?

Unity 6 actually supports gradle 8 out of the box, but the android export isn't compatible with the current version of this plugin.