flutter-unity-view-widget icon indicating copy to clipboard operation
flutter-unity-view-widget copied to clipboard

Getting could not resolve project unityLibrary error

Open Charith0401 opened this issue 3 years ago • 4 comments

Hi guys !

Been trying to fix this error on my own and after countless hours of research i still havent managed to solve this one could you guys help me solve it please ?

A pic of the error list: image

Thanks in advance guys !

Charith0401 avatar Nov 09 '22 14:11 Charith0401

Can you experiment with the buildType attributes in you build.gradle files? This should be placed inside the android { } element.

android/app/build.gradle should have a signingConfig defined. This is probably already (partially) there.

buildTypes {
        release {
            // .release if you have a keystore setup
            signingConfig signingConfigs.debug
        }
        debug {
            signingConfig signingConfigs.debug
        }
        profile {
            signingConfig signingConfigs.debug
        }
        innerTest {
            matchingFallbacks = ['debug', 'release']
        }
   }

Sometimes you need to add matching elements to the unity gradle AFTER an export from Unity. https://github.com/juicycleff/flutter-unity-view-widget/issues/527#issuecomment-1028858458 android/unityLibrary/build.gradle

buildTypes {
        release {
        }
        debug {
        }
        profile {
        }
        innerTest {
            matchingFallbacks = ['debug', 'release']
        }
    }

Profile and innerTest can likely be omitted in both if you don't use them.

timbotimbo avatar Nov 09 '22 22:11 timbotimbo

I tried replacing that in the app level build.gradle but did not work.

nyck33@nyck33-IdeaPad-Gaming-3-15ACH6:~/Documents/flutter/flutter-unity-view-widget/example$ flutter run
Launching lib/main.dart on A202ZT in debug mode...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :unityLibrary.
     Required by:
         project :app
      > No matching configuration of project :unityLibrary was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', 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 984ms
Running Gradle task 'assembleDebug'...                           1,467ms
Exception: Gradle task assembleDebug failed with exit code 1

nyck33 avatar May 04 '23 07:05 nyck33

Can you experiment with the buildType attributes in you build.gradle files? This should be placed inside the android { } element.

android/app/build.gradle should have a signingConfig defined. This is probably already (partially) there.

buildTypes {
        release {
            // .release if you have a keystore setup
            signingConfig signingConfigs.debug
        }
        debug {
            signingConfig signingConfigs.debug
        }
        profile {
            signingConfig signingConfigs.debug
        }
        innerTest {
            matchingFallbacks = ['debug', 'release']
        }
   }

Sometimes you need to add matching elements to the unity gradle AFTER an export from Unity. #527 (comment) android/unityLibrary/build.gradle

buildTypes {
        release {
        }
        debug {
        }
        profile {
        }
        innerTest {
            matchingFallbacks = ['debug', 'release']
        }
    }

Profile and innerTest can likely be omitted in both if you don't use them.

If need to support profile mode, also add the above buildTypes to 'android/unityLibrary/xrmanifest.androidlib/build.gradle'

buildTypes { release { } debug { } profile { } innerTest { matchingFallbacks = ['debug', 'release'] } }


ebwood avatar Jun 01 '24 18:06 ebwood

Sometimes, check if you have created the folder but hasn't exported from unity, to me it was that.

CristovoXDGM avatar Jul 08 '24 17:07 CristovoXDGM