1

I would like to use flutter_unity_widget in order to embed my unity project and use it as a plugin in apps.

I followed this link:

https://pub.dev/packages/flutter_unity_widget

but it isn't compiled as:

* Where:
Build file 'C:\Users\Maor\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_unity_widget-0.1.6+8\android\build.gradle' line: 39

* What went wrong:
A problem occurred evaluating project ':flutter_unity_widget'.
> Project with path ':unity-classes' could not be found in project ':flutter_unity_widget'.

while line 39 in flutter_unity_widget android build.gradle is the dependency:

implementation project(':unity-classes')

follow this screenshot

Steps:

  1. I added the unity project in the root folder
  1. I opened it in Unity, set the player settings and exported it to Android.

  2. pubspec.yaml: flutter_unity_widget: ^0.1.6+5

  3. root android / settings.gradle:

    include ":UnityExport"
    project(":UnityExport").projectDir = file("./UnityExport")
    
  4. root android / UnityExport/build.gradle:

    dependencies {
        implementation project(':unity-classes')
    }
    
  5. file -> project structures -> modules: added unity-classes.jar as a module

I'm trying to run the plugin but get the above error.

Any idea what is wrong?

Erez git
  • 73
  • 8

1 Answers1

0

Need to add 2 lines at the bottom of settings.gradle file (android/settings.gradle). The settings.gradle file is in main android project, not in flutter_unity_widget project.

include ":unity-classes"

project(":unity-classes").projectDir = file("./unity-classes")
Dharman
  • 30,962
  • 25
  • 85
  • 135
Cu'i Bap
  • 188
  • 2
  • 7