qonversion/unity-sdk

Android Broken dependency to "com.google.firebase:firebase-messaging:$firebase_messaging_version"

OliverRiisager opened this issue ยท 12 comments

I wrote you guys about 10 days ago about this issue. Regarding gradle builds failing, specifically about cloud builds failing (as well as android studio exports) at this line here :
8353: [Unity] boolean result = Qonversion.handleNotification(notificationInfo); 8354: [Unity] class file for com.google.firebase.messaging.RemoteMessage not found

Now - i have solved this issue by going into your android Qonversion project and locating the specific version of com.google.firebase.messaging that you guys are using - and added that as a dependency in our custom gradle file. It seems to me, as if that dependency is not properly propagated out to the unity sdk. I feel like this should have been something you guys could have tested.

Also - i would recommend that you go in and update the version you point to in your installation guide on your documentation page, as that one has failing iOS cloud builds also. (The one specified as the Git url approach)

I hope this can be resolved soon. I dont know much about android, but i feel like the android issue could potentially live in the QonversionDependencies.xml file.

For anyone else having this issue - you can in you mainTemplate.gradle add the following line as a workaround until this is fixed (this is for the 3.4.1 release):
image

Hi, @OliverRiisager
Thanks for the solution. You are right, and the problem is related to the firebase messaging. And, of course, we tested that before the release. The strange thing is I can't reproduce that error on my device. I unsuccessfully tried to reproduce that issue in an empty project a few times. Anyway, I'll continue investigating the problem, and we will fix it in the following versions.
Thank you again ๐Ÿ™

Deal! Thank you so much for the help!

Yes, I tried. And there wasn't an error. I'll try a few more ways and let you know.

No, we don't use ProGuard or R8 in our SDK.

@suriksarkisyan no, but we use R8 in ours. And we also have custom proguard file enabled - though it is empty at the moment.

As promised - here are our settings :

Dependencies :
    "com.google.external-dependency-manager": "file:../Firebase/firebase-unity-packages/com.google.external-dependency-manager-1.2.166.tgz",
    "com.google.firebase.app": "file:../Firebase/firebase-unity-packages/com.google.firebase.app-8.1.0.tgz",
    "com.google.firebase.auth": "file:../Firebase/firebase-unity-packages/com.google.firebase.auth-8.1.0.tgz",
    "com.google.firebase.firestore": "file:../Firebase/firebase-unity-packages/com.google.firebase.firestore-8.1.0.tgz",
    "com.google.firebase.functions": "file:../Firebase/firebase-unity-packages/com.google.firebase.functions-8.1.0.tgz",
	
	Package install guide : 
		Due to this issue we can not use package manager in the normal way for Firebase: 
		https://github.com/firebase/quickstart-unity/issues/1030

		Update firebase by following these instructions:
		https://firebase.google.com/docs/unity/setup-alternative?hl=ca#alternative_unity_package_manager

		Using this download achieve:
		https://developers.google.com/unity/archive?hl=ca

		Drop the files in Firebase/firebase-unity-packages
		Update Packages/manifest.json to local paths
		
GvhProjectSettings:
	<projectSettings>
		<projectSetting name="com.google.external-dependency-managerAnalyticsEnabled" value="False"/>
		<projectSetting name="com.google.firebaseAnalyticsEnabled" value="False"/>
		<projectSetting name="Google.IOSResolver.AutoPodToolInstallInEditor" value="True"/>
		<projectSetting name="Google.IOSResolver.CocoapodsIntegrationMethod" value="2"/>
		<projectSetting name="Google.IOSResolver.PodfileAddUseFrameworks" value="True"/>
		<projectSetting name="Google.IOSResolver.PodfileAllowPodsInMultipleTargets" value="True"/>
		<projectSetting name="Google.IOSResolver.PodfileAlwaysAddMainTarget" value="True"/>
		<projectSetting name="Google.IOSResolver.PodfileEnabled" value="True"/>
		<projectSetting name="Google.IOSResolver.PodfileStaticLinkFrameworks" value="False"/>
		<projectSetting name="Google.IOSResolver.PodToolExecutionViaShellEnabled" value="False"/>
		<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False"/>
		<projectSetting name="Google.PackageManagerResolver.Enable" value="True"/>
		<projectSetting name="Google.PackageManagerResolver.PromptToAddRegistries" value="True"/>
		<projectSetting name="Google.PackageManagerResolver.PromptToMigratePackages" value="True"/>
		<projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False"/>
		<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False"/>
		<projectSetting name="GooglePlayServices.AndroidPackageInstallationEnabled" value="True"/>
		<projectSetting name="GooglePlayServices.AutoResolutionDisabledWarning" value="True"/>
		<projectSetting name="GooglePlayServices.AutoResolveOnBuild" value="True"/>
		<projectSetting name="GooglePlayServices.AutoResolverEnabled" value="False"/>
		<projectSetting name="GooglePlayServices.ExplodeAars" value="True"/>
		<projectSetting name="GooglePlayServices.LocalMavenRepoDir" value="Assets/GeneratedLocalRepo"/>
		<projectSetting name="GooglePlayServices.PatchAndroidManifest" value="True"/>
		<projectSetting name="GooglePlayServices.PatchMainTemplateGradle" value="True"/>
		<projectSetting name="GooglePlayServices.PatchPropertiesTemplateGradle" value="True"/>
		<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False"/>
		<projectSetting name="GooglePlayServices.UseGradleDaemon" value="False"/>
		<projectSetting name="GooglePlayServices.UseJetifier" value="False"/>
		<projectSetting name="GooglePlayServices.VerboseLogging" value="False"/>
	</projectSettings>

AndroidResolvedDependencies.xml:
	<dependencies>
		<packages>
			<package>com.fasterxml.jackson.core:jackson-databind:2.11.1</package>
			<package>com.google.android.gms:play-services-base:17.6.0</package>
			<package>com.google.firebase:firebase-analytics:19.0.0</package>
			<package>com.google.firebase:firebase-app-unity:8.1.0</package>
			<package>com.google.firebase:firebase-auth:21.0.1</package>
			<package>com.google.firebase:firebase-auth-unity:8.1.0</package>
			<package>com.google.firebase:firebase-common:20.0.0</package>
			<package>com.google.firebase:firebase-firestore:23.0.1</package>
			<package>com.google.firebase:firebase-firestore-unity:8.1.0</package>
			<package>com.google.firebase:firebase-functions:20.0.0</package>
			<package>com.google.firebase:firebase-functions-unity:8.1.0</package>
			<package>io.qonversion.android.sdk:sdk:3.2.4</package>
			<package>org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61</package>
		</packages>
		<files>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/8.1.0/firebase-app-unity-8.1.0.aar</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/8.1.0/firebase-app-unity-8.1.0.pom</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-auth-unity/8.1.0/firebase-auth-unity-8.1.0.aar</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-auth-unity/8.1.0/firebase-auth-unity-8.1.0.pom</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-firestore-unity/8.1.0/firebase-firestore-unity-8.1.0.aar</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-firestore-unity/8.1.0/firebase-firestore-unity-8.1.0.pom</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-functions-unity/8.1.0/firebase-functions-unity-8.1.0.aar</file>
			<file>Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-functions-unity/8.1.0/firebase-functions-unity-8.1.0.pom</file>
		</files>
		<settings>
			<setting name="androidAbis" value="arm64-v8a,armeabi-v7a"/>
			<setting name="bundleId" value="{bundleid}"/>
			<setting name="explodeAars" value="True"/>
			<setting name="gradleBuildEnabled" value="True"/>
			<setting name="gradlePropertiesTemplateEnabled" value="True"/>
			<setting name="gradleTemplateEnabled" value="True"/>
			<setting name="installAndroidPackages" value="True"/>
			<setting name="localMavenRepoDir" value="Assets/GeneratedLocalRepo"/>
			<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>

btw you have to change this to be your own bundle id. setting name="bundleId" value="{bundleid}"

Hello @OliverRiisager! We've researched everything and understand the problem, but we cannot reproduce it locally. The temporal fix is like the one you posted in the above messages. By the way, we will fix this issue in future releases. Thank you for your report and help in determining this issue!

Let us know if you have any further questions. We'll be glad to assist!

Just wanted to point out, that it works now after updating to 4.0.1. I see you restructured the packages/changed your import statements around - which I'm guessing is the reason that it is now working. That still doesn't change the fact that it doesn't work for your previous implementations - in case users still want to use that version for whatever reason I suggest letting this fix live in a doc somewhere for them to use.

Sorry for not getting back to you sooner, somehow we've lost this issue. Yes, you are right. The original problem was fixed from version 4.0.0 as we removed the firebase-messaging dependency, so the best solution would be to migrate to the latest SDK version.

Those, who don't want to migrate right now, can consider the solution from the author's start message.

We will consider adding a suggested workaround to our documentation. I'm closing this issue as the problem is fixed in the latest SDK versions. Thank you for your report and feel free to contact us if you have any further questions!