firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
836 stars 431 forks source link

Unable to find FirebaseCppApp-6.2.0 #403

Closed zeroregard closed 5 years ago

zeroregard commented 5 years ago

Please fill in the following fields:

Unity editor version: 2018.3.2f1 Firebase Unity SDK version: 6.2.0 Firebase plugins in use (Auth, Database, etc.): Analytics Additional SDKs you are using (Facebook, AdMob, etc.): Facebook, Branch, 8th Wall Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac Platform you are targeting (iOS, Android, and/or desktop): Android + iOS

Please describe the issue here:

I'm building for Android, and the app crashes instantly with the DllNotFoundException mentioned in https://github.com/firebase/quickstart-unity/issues/398 and https://github.com/firebase/quickstart-unity/issues/395

I exported the project and noticed that no libraries from firebase are in the libs folder. I did run the newest version of the play services resolver:

<dependencies>
  <packages>
    <package>com.android.support:appcompat-v7:25.3.1</package>
    <package>com.android.support:cardview-v7:25.3.1</package>
    <package>com.android.support:customtabs:25.3.1</package>
    <package>com.android.support:support-v4:25.3.1</package>
    <package>com.android.support:support-v4:26.1.0</package>
    <package>com.google.auto.value:auto-value-annotations:1.6.3</package>
    <package>com.google.firebase:firebase-analytics:17.0.0</package>
    <package>com.google.firebase:firebase-analytics-unity:6.2.0</package>
    <package>com.google.firebase:firebase-app-unity:6.2.0</package>
    <package>com.google.firebase:firebase-common:18.0.0</package>
    <package>com.google.firebase:firebase-iid:[19.0.1]</package>
  </packages>
  <files />
  <settings>
    <setting name="androidAbis" value="arm64-v8a,armeabi-v7a,x86" />
    <setting name="bundleId" value="fi.ThreeDBear.ThreeDBearAR" />
    <setting name="explodeAars" value="True" />
    <setting name="gradleBuildEnabled" value="True" />
    <setting name="gradleTemplateEnabled" value="True" />
    <setting name="installAndroidPackages" value="True" />
    <setting name="packageDir" value="Assets/Plugins/Android" />
    <setting name="patchAndroidManifest" value="True" />
    <setting name="patchMainTemplateGradle" value="True" />
    <setting name="projectExportEnabled" value="True" />
    <setting name="useJetifier" value="False" />
  </settings>
</dependencies>

This looks good to me. It did however not change my mainTemplate.gradle, if that was supposed to happen? This looks like so:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
**BUILD_SCRIPT_DEPS**}
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'GoogleAIDL', ext:'aar')
    implementation(name: 'GooglePlay', ext:'aar')
    implementation(name: 'NatCam', ext:'aar')
    implementation(name: 'NatCorder', ext:'aar')
    implementation(name: 'NatMic', ext:'aar')
    implementation(name: 'NatRender', ext:'aar')
    implementation(name: 'NatShare', ext:'aar')
    implementation(name: 'UnityAds', ext:'aar')
    implementation(name: 'XRPlugin', ext:'aar')
    implementation(name: 'android-filebrowser-release', ext:'aar')
    implementation(name: 'android.arch.lifecycle.runtime-1.0.0', ext:'aar')
    //implementation(name: 'arcore_client', ext:'aar')
    //implementation(name: 'arcore_unity', ext:'aar')
    implementation(name: 'com.NicholasSheehan.UnityNativeShareKit v1.0.2-release', ext:'aar')
    implementation(name: 'com.android.support.animated-vector-drawable-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.appcompat-v7-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.cardview-v7-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.customtabs-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-compat-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-core-ui-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-core-utils-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-fragment-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-media-compat-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-v4-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-vector-drawable-26.1.0', ext:'aar')
    implementation(name: 'common', ext:'aar')
    implementation(name: 'facebook-android-wrapper-7.11.1', ext:'aar')
    implementation(name: 'facebook-applinks', ext:'aar')
    implementation(name: 'facebook-common', ext:'aar')
    implementation(name: 'facebook-core', ext:'aar')
    implementation(name: 'facebook-login', ext:'aar')
    implementation(name: 'facebook-messenger', ext:'aar')
    implementation(name: 'facebook-places', ext:'aar')
    implementation(name: 'facebook-share', ext:'aar')
    //implementation(name: 'google_ar_optional', ext:'aar')
    //implementation(name: 'unityandroidpermissions', ext:'aar')
    //implementation(name: 'unitygar', ext:'aar')
    implementation(name: 'wikitude-unity-bridge', ext:'aar')
    implementation project(':GalleryScreenshot')
}

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    }**SIGN**

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**

I'm building to ARMv7, ARM64 as well as x86. I'm also using .NET4 and the scripting backend is set to IL2CPP.

I'm not very experienced when it comes to the process of turning DLL's into libs compatible with Android. In which phase is this controlled? That might give me some insight into what is different in this project.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

No, the issue couldn't be reproduced in the quickstarts project. I took the test project, opened the analytics project and fed it the newest (6.2.0) version of Firebase.

Here's the Android Resolver Dependencies for that project:

<dependencies>
  <packages>
    <package>com.google.auto.value:auto-value-annotations:1.6.3</package>
    <package>com.google.firebase:firebase-analytics:17.0.0</package>
    <package>com.google.firebase:firebase-analytics-unity:6.2.0</package>
    <package>com.google.firebase:firebase-app-unity:6.2.0</package>
    <package>com.google.firebase:firebase-common:18.0.0</package>
    <package>com.google.firebase:firebase-iid:[19.0.1]</package>
  </packages>
  <files>
    <file>Assets/Plugins/Android/androidx.annotation.annotation-1.0.0.jar</file>
    <file>Assets/Plugins/Android/androidx.arch.core.core-common-2.0.0.jar</file>
    <file>Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.asynclayoutinflater.asynclayoutinflater-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.collection.collection-1.0.0.jar</file>
    <file>Assets/Plugins/Android/androidx.coordinatorlayout.coordinatorlayout-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.core.core-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.cursoradapter.cursoradapter-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.customview.customview-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.documentfile.documentfile-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.drawerlayout.drawerlayout-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.fragment.fragment-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.interpolator.interpolator-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.legacy.legacy-support-core-ui-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.legacy.legacy-support-core-utils-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-common-2.0.0.jar</file>
    <file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-2.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-core-2.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-runtime-2.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.lifecycle.lifecycle-viewmodel-2.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.loader.loader-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.localbroadcastmanager.localbroadcastmanager-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.print.print-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.slidingpanelayout.slidingpanelayout-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.swiperefreshlayout.swiperefreshlayout-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.0.0.aar</file>
    <file>Assets/Plugins/Android/androidx.viewpager.viewpager-1.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-base-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-api-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-stats-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-tasks-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.auto.value.auto-value-annotations-1.6.3.jar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-analytics-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-analytics-unity-6.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-app-unity-6.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-common-18.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-iid-19.0.1.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-17.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-measurement-connector-18.0.0.aar</file>
  </files>
  <settings>
    <setting name="androidAbis" value="armeabi-v7a,x86" />
    <setting name="bundleId" value="com.google.firebase.unity.analytics.testapp" />
    <setting name="explodeAars" value="True" />
    <setting name="gradleBuildEnabled" value="True" />
    <setting name="gradleTemplateEnabled" value="False" />
    <setting name="installAndroidPackages" value="True" />
    <setting name="packageDir" value="Assets/Plugins/Android" />
    <setting name="patchAndroidManifest" value="True" />
    <setting name="patchMainTemplateGradle" value="True" />
    <setting name="projectExportEnabled" value="True" />
    <setting name="useJetifier" value="True" />
  </settings>
</dependencies>

Running the resolver in this project actually gives me a bunch of com.google.firebase .aars in my Plugins/Android folder. I'll try copying them over to my own project and see if that works for now, but it would be nice if the resolver worked in my own project as well!

I already spent hours and hours (every build takes 30 minutes) trying to resolve the issue, so any insight is very appreciated!

zeroregard commented 5 years ago

Update: Copying over those .aars from the example project to my own project do not result in any firebase-related .so files showing up in my .apk's /lib/ folders.

a-maurice commented 5 years ago

Hi @mathiassiig

Based on what you've posted, it sounds like another plugin is causing problems with the resolution of the Firebase libraries. Just to confirm, you have the .srcaar files that should be in Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/6.2.0?

Top the toolbar, if you go to Assets > Play Services Resolver > Android Resolver, can you see if your settings are different from the default? Also, if you use 'Display Libraries', does the output seem correct?

Finally, when you run the resolver, are there any warnings or errors being logged?

zeroregard commented 5 years ago

Hi @a-maurice I did have some files there: firebase-app-unity-6.2.0.srcaar and firebase-app-unity-6.2.0.pom Setings are indeed default, but I just enabled verbose logging. No warnings or errors:

Detected Android Gradle Plugin Version 3.2.0.
Reading Android dependency XML file Assets/Firebase/Editor/AnalyticsDependencies.xml
DependOn - group: com.google.firebase artifact: firebase-analytics version: 17.0.0 packageIds:  repositories: 
DependOn - group: com.google.firebase artifact: firebase-iid version: [19.0.1] packageIds:  repositories: 
DependOn - group: com.google.firebase artifact: firebase-analytics-unity version: 6.2.0 packageIds:  repositories: Assets/Firebase/m2repository
Reading Android dependency XML file Assets/Firebase/Editor/AppDependencies.xml
DependOn - group: com.google.firebase artifact: firebase-common version: 18.0.0 packageIds:  repositories: 
DependOn - group: com.google.firebase artifact: firebase-analytics version: 17.0.0 packageIds:  repositories: 
DependOn - group: com.google.firebase artifact: firebase-app-unity version: 6.2.0 packageIds:  repositories: Assets/Firebase/m2repository
DependOn - group: com.google.auto.value artifact: auto-value-annotations version: 1.6.3 packageIds:  repositories: 
Checking for changes from previous resolution...
No changes found, resolution skipped.
moritz-wundke commented 5 years ago

I noticed that the universal APK had the .so files only for it's arm-v7a build, could it be that something is not correctly resolved with IL2CPP and ABI splitting?

zeroregard commented 5 years ago

At least the problem is similar in the other issue, https://github.com/firebase/quickstart-unity/issues/398

moritz-wundke commented 5 years ago

Yep, had to downgrade to 5.2.1 where it even works with IL2CPP. I guess this issue should get some priority due to the fact that the googles play store will enforce 64bit binaries by the 1st of August.

zeroregard commented 5 years ago

I didn't manage to downgrade to 5.2.1 successfully. I guess the combination of targeting three architectures, compiling to IL2CPP and using dotnet 4.6 is volatile with Firebase. I started going through this https://groups.google.com/forum/#!topic/firebase-talk/2w1Lk62VIcg but I'm getting

Assembly 'Library/ScriptAssemblies/Assembly-CSharp.dll' will not be loaded due to errors:
Reference has errors 'Firebase.Analytics'.

Assembly 'Library/ScriptAssemblies/Assembly-CSharp-Editor.dll' will not be loaded due to errors:
Reference has errors 'Assembly-CSharp'.

Assembly 'Assets/Firebase/Plugins/Firebase.Analytics.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.Tasks'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/Firebase/Plugins/Firebase.App.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.Tasks'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/Firebase/Plugins/Firebase.Platform.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.Compat'. Is the assembly missing or incompatible with the current platform?
Unable to resolve reference 'Unity.Tasks'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/Firebase/Editor/Firebase.Editor.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.84.0.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?

Though at this point, this isn't really relevant to the original issue, but I am very much open to any sort of hack to get this working.

moritz-wundke commented 5 years ago

We do not use Analytics, so no idea on that front but for the parse SDK you need the special one for .net4x, I just got it from a higher Firebase SDK.

chkuang-g commented 5 years ago

Hi @mathiassiig I had a hard time to reproduce it. I used Unity 2019.1.11f1 and Firebase SDK 6.2.0 with Auth testapp from https://github.com/firebase/quickstart-unity. And I did not see this exception at all.

Could you provide more detail about how to reproduce this exception? Ex. your Unity configuration, which platform did you see this exception, sample project or log. It would be great if you can reproduce it with any of our sample project. https://github.com/firebase/quickstart-unity

Otherwise,there are a couple things you can try:

  1. If you upgraded to the latest Play Service Resolver, try to downgrade to that provided in Firebase SDK.
  2. Try to use Assets > Play Services Resolver > Android Resolver > Force Resolve
  3. Try to remove all Firebase plugin and reimport again.

Please let us know

robinryf commented 5 years ago

Just sharing my story. I just had this issue when starting the Unity Android App I got this error: "Unable to find FirebaseCppApp-6.2.1" on startup. My Unity project was set to only build 32-bit and this error came up when I changed the build settings to also build 64-bit and x86. I had to run the Google Play Resolver once more and then everything went smoothly. If you changed your target arch then make sure you get a complete Google Play Resolve before build.

Not sure if this is the whole issue but that worked for me. Unity 2019.1.12f1 Android 8.1.0 Firebase SDK 6.2.1 Google Play Resolver 1.2.122

kdzapp commented 5 years ago

When I ran into this problem I fixed it by reimporting all of the libraries I used - I think I had a version mismatch (i.e. RemoteConfig was 6.2.X and my analytics was older)

DeniMN commented 5 years ago

The problem was fixed:https://firebase.google.com/support/release-notes/unity Download new firebase plugin version

zeroregard commented 5 years ago

Nope. It says in the log it was fixed for 2019.3 and 2019.2, I'm still on 2018.3.2f1, so it's likely a different issue. I'm only using the analytics plugin still.

DllNotFoundException: Unable to load DLL 'FirebaseCppApp-6_3_0': The specified module could not be found.

Unity: 2018.3.2f1 Firebase: 6.3.0 Scripting backend: IL2CPP Scripting runtime: .NET 4 Api compatibility: .NET 4.X Target architectures: ARMv7, ARM64, x86

The resolver looks like so

<dependencies>
  <packages>
    <package>com.android.support:appcompat-v7:25.3.1</package>
    <package>com.android.support:cardview-v7:25.3.1</package>
    <package>com.android.support:customtabs:25.3.1</package>
    <package>com.android.support:support-v4:25.3.1</package>
    <package>com.android.support:support-v4:26.1.0</package>
    <package>com.google.firebase:firebase-analytics:17.0.1</package>
    <package>com.google.firebase:firebase-analytics-unity:6.3.0</package>
    <package>com.google.firebase:firebase-app-unity:6.3.0</package>
    <package>com.google.firebase:firebase-common:18.0.0</package>
    <package>com.google.firebase:firebase-iid:[19.0.1]</package>
  </packages>
  <files />
  <settings>
    <setting name="androidAbis" value="arm64-v8a,armeabi-v7a,x86" />
    <setting name="bundleId" value="fi.ThreeDBear.ThreeDBearAR" />
    <setting name="explodeAars" value="True" />
    <setting name="gradleBuildEnabled" value="True" />
    <setting name="gradleTemplateEnabled" value="True" />
    <setting name="installAndroidPackages" value="True" />
    <setting name="packageDir" value="Assets/Plugins/Android" />
    <setting name="patchAndroidManifest" value="True" />
    <setting name="patchMainTemplateGradle" value="True" />
    <setting name="projectExportEnabled" value="False" />
    <setting name="useJetifier" value="True" />
  </settings>
</dependencies>
ivk1800 commented 5 years ago

@mathiassiig you need remove aars manually and make force resolve. I have same issue and it helped me.

tonyjoseph456 commented 5 years ago

@ivk1800 can you please give more information about that. I'm also getting same error

E Unity : Unable to find FirebaseCppApp-6_4_0 E Unity : DllNotFoundException: Unable to load DLL 'FirebaseCppApp-6_4_0': The specified module could not be found. E Unity : at Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil (Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate nullReferenceDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate outOfMemoryDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate overflowDelegate,