Project with path could not be found in project ':unityLibrary'

Hello. I added “implementation project” for Firebase in mainTemplate.gradle. How fix this error?

  • What went wrong:
    A problem occurred evaluating project ‘:unityLibrary’.

Project with path ‘:FirebaseApp.androidlib’ could not be found in project ‘:unityLibrary’.

mainTemplate.gradle

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation project(':FirebaseApp.androidlib')

    implementation(name: 'facebook-android-wrapper-9.0.0', ext:'aar')
    implementation 'com.facebook.android:facebook-share:9.+'
    implementation 'com.facebook.android:facebook-applinks:9.+'
    implementation 'com.facebook.android:facebook-common:9.+'
    implementation 'com.facebook.android:facebook-share:9.+'
    implementation 'com.facebook.android:facebook-core:9.+'
    implementation 'com.facebook.android:facebook-login:9.+'
    implementation 'com.facebook.android:facebook-messenger:9.+'
    implementation 'com.facebook.android:facebook-share:9.+'
    implementation 'com.facebook.android:facebook-gamingservices:9.+'

    implementation 'com.google.firebase:firebase-messaging:21.+'
    implementation 'com.google.firebase:firebase-analytics:18.+'
    implementation 'com.google.firebase:firebase-storage:19.+'
    implementation 'com.google.firebase:firebase-auth:20.+'
    implementation 'com.google.firebase:firebase-auth-interop:19.+'
    implementation 'com.google.firebase:firebase-common:19.+'
    implementation 'com.google.firebase:firebase-components:16.+'
    implementation 'com.google.firebase:firebase-iid:21.+'
    implementation 'com.google.firebase:firebase-iid-interop:17.+'
    implementation 'com.google.firebase:firebase-installations:16.+'
    implementation 'com.google.firebase:firebase-installations-interop:16.+'
    implementation 'com.google.firebase:firebase-measurement-connector:18.+'
    implementation 'com.google.firebase:firebase-datatransport:17.0.+'
    implementation 'com.google.firebase:firebase-encoders-json:17.+'
    implementation 'com.google.firebase:firebase-firestore:22.+'
    implementation 'com.google.firebase:protolite-well-known-types:17.+'

    implementation(name: 'com.facebook.android.audience-network-sdk-6.3.0', ext:'aar')

    implementation(name: 'com.google.firebase.firebase-analytics-unity-7.0.2', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-app-unity-7.0.2', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-auth-unity-7.0.2', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-firestore-unity-7.0.2', ext:'aar')
**DEPS**}

android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 31
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

img: vs-TR24-Xgk-UA hosted at ImgBB — ImgBB

Send me a screenshot of your Temp/gradleOut/unityLibrary folder.

Hey I am having the same issue with my project when I export my unity project to android studio.
I’m using Unity 2020.3.6f1

I am not sure where this path is

but here is where I exported the project.

7661359--956149--upload_2021-11-16_17-44-21.png

and this is inside the unityLibrary folder

7661359--956152--upload_2021-11-16_17-45-54.png

Hope this is what you want.

Also sorry for any mistakes this is my first time posting in the forum.

Do have any gradle files overridden? Also please post the full error

This is the error I’m getting in android studio. It says …140 more at the end but I’m unsure how to get the more part as I’ve expanded to the maximum.
Also I’ve changed the path displayed a bit since the project name is a little sensitive.

I am overwriting 2 gradle files.

mainTemplate.gradle

gradleTemplate.properties

I did try removing these gradle files, ForceResolve with External Dependency Manager and exporting again but that didn’t work so I reverted it to what it was before.

It says, you’re referencing FirebaseApp.androidlib from unityLibrary’s build.gradle, and it doesn’t find it. Probably the path is incorrect.

Check the final unityLibrary\build.gradle file

So this is my build.gradle file. I’m not sure how to tell android studio to locate FirebaseApp.androidlib. Could you let me know how to do this. Also can I add this to my gradle template so that the process can be automated in the future?

Could you locate settings.gradle, I think you might be missing an include, do you have

include 'unityLibrary:Firebase.androidlib'

So I found a fix but it created a new error.

The fix I did was I added these 2 lines to my settings.gradle file (which I copied from the unity as a library tutorial)

include ':FirebaseApp.androidlib'
project(':FirebaseApp.androidlib').projectDir=new File('..\\AndroidExport\\unityLibrary\\FirebaseApp.androidlib')

And then in my unityLibrary build.gradle I added a ‘:’ infront of the path in the implementation line so it became this

implementation project(':FirebaseApp.androidlib')

I tried it without the ‘:’ but it didn’t work. I’m not very familiar with android studio so I’m not sure what the significance is.

The problem is that I’m getting a new error which happens once gradle invocation finishes and it starts building

2 files found with path 'firebase-annotations.properties'.
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information

The link doesn’t work which felt like a scam but I tried to do some research on the packaging options block but I don’t think this is something I can learn overnight

I tried this as well but it throws the previous error.

Sorry, I am not familiar with this error… I am not sure if FireBase has support forum, but you might want to ask there.

This worked for me! Thanks.