AndroidManifest merge fail. Please help!
I have the following errors on compile:
Error: [Temp/StagingArea/AndroidManifest-main.xml, /Users/AlexBo/Development/Unity Projects/Boozee/Temp/StagingArea/android-libraries/com.google.firebase.firebase-iid-16.0.0/AndroidManifest.xml:11] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Error: [Temp/StagingArea/AndroidManifest-main.xml, /Users/AlexBo/Development/Unity Projects/Boozee/Temp/StagingArea/android-libraries/com.google.firebase.firebase-measurement-connector-impl-16.0.1/AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
@AlekseiBo which Unity version are you using and which SDK are you using? We fixed (i.e worked around) an issue with manifest merging in Unity 2018 in our most recent release (Firebase Unity SDK 5.2.0).
@lluma mentioned on #175 they're having the same issue as well.
In both cases, do you have issues building our sample applications? I recommend starting there and looking at differences between your game project and our samples (which should work) then slowly narrowing down the differences. For example, if you're using other plugins in your project they could be causing problems.
@stewartmiles i have the same problem. I use Unity 5.6.5p4, Firebase 5.2.0
- com.google.firebase.firebase-iid-16.2.0
- com.google.firebase.firebase-measurement-connector-impl-16.0.1
- com.google.firebase.firebase-auth-16.0.2
I resolve problem by this method: I extract 3 aar files above and move this tag <service android:name="com.google.firebase.components.ComponentDiscoveryService"> in each AndroidManifest in 3 extracted folder of aar files to main AndroidManifest at Assets/Plugins/Android/ like this:
<service android:name="com.google.firebase.components.ComponentDiscoveryService">
<!--com.google.firebase.firebase-iid-->
<meta-data
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<!--com.google.firebase.firebase-measurement-connector-impl-->
<meta-data
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<!--com.google.firebase.firebase-auth-->
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
I run application on device with logcat warning like bellow but FirebaseApp.CheckAndFixDependenciesAsync() still return DependencyStatus.Available. @stewartmiles Will Firebase work correctly when i merged AndroidManifest like above?
Logcat Warning:
08-01 10:11:47.294: W/ComponentDiscovery(1223): Class com.google.firebase.auth.FirebaseAuthRegistrar is not an found.
08-01 10:11:47.294: W/ComponentDiscovery(1223): java.lang.ClassNotFoundException: com.google.firebase.auth.FirebaseAuthRegistrar
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.Class.classForName(Native Method)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.Class.forName(Class.java:400)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.Class.forName(Class.java:326)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.components.zzc.zza(SourceFile:63)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.components.zzc.zza(SourceFile:56)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.<init>(SourceFile:496)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:324)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread.installProvider(ActivityThread.java:5951)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread.installContentProviders(ActivityThread.java:5533)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5472)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread.-wrap2(ActivityThread.java)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1583)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.os.Handler.dispatchMessage(Handler.java:102)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.os.Looper.loop(Looper.java:241)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at android.app.ActivityThread.main(ActivityThread.java:6217)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.reflect.Method.invoke(Native Method)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
08-01 10:11:47.294: W/ComponentDiscovery(1223): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.auth.FirebaseAuthRegistrar" on path: DexPathList[[zip file "/data/app/com.nzt.diablo.legends-1/base.apk"],nativeLibraryDirectories=[/data/app/com.nzt.diablo.legends-1/lib/arm, /data/app/com.nzt.diablo.legends-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
08-01 10:11:47.294: W/ComponentDiscovery(1223): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
08-01 10:11:47.294: W/ComponentDiscovery(1223): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
08-01 10:11:47.294: W/ComponentDiscovery(1223): ... 24 more
08-01 10:11:47.296: W/ComponentDiscovery(1223): Class com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar is not an found.
08-01 10:11:47.296: W/ComponentDiscovery(1223): java.lang.ClassNotFoundException: com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.Class.classForName(Native Method)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.Class.forName(Class.java:400)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.Class.forName(Class.java:326)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.components.zzc.zza(SourceFile:63)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.components.zzc.zza(SourceFile:56)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.<init>(SourceFile:496)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:324)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread.installProvider(ActivityThread.java:5951)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread.installContentProviders(ActivityThread.java:5533)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5472)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread.-wrap2(ActivityThread.java)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1583)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.os.Handler.dispatchMessage(Handler.java:102)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.os.Looper.loop(Looper.java:241)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at android.app.ActivityThread.main(ActivityThread.java:6217)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.reflect.Method.invoke(Native Method)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
08-01 10:11:47.296: W/ComponentDiscovery(1223): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" on path: DexPathList[[zip file "/data/app/com.nzt.diablo.legends-1/base.apk"],nativeLibraryDirectories=[/data/app/com.nzt.diablo.legends-1/lib/arm, /data/app/com.nzt.diablo.legends-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
08-01 10:11:47.296: W/ComponentDiscovery(1223): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
08-01 10:11:47.296: W/ComponentDiscovery(1223): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
08-01 10:11:47.296: W/ComponentDiscovery(1223): ... 24 more
I try to use Firebase along with ARCore plugin. And I have a feeling that's the case, but I don't know how to resolve it or to whom to address.
@exzizt FYI
@trinhvietvan hacking the manifests is very likely to not work, the set of warnings you're seeing suggests the services we expected to start are not running as expected.
@AlekseiBo I'm not sure what state the ARCore plugin is in but I think they're using https://github.com/googlesamples/unity-jar-resolver like Firebase.
Everyone, if you've integrated another plugin with Firebase I recommend pulling the latest https://github.com/googlesamples/unity-jar-resolver and force resolving your dependencies. Definitely start with one of our sample projects (in this repo) to see whether things work then look at the delta from there between your project.
Once thing to note is that we rewrite the AndroidManifest.xml in the plugin to expand all ${applicationId} variable references. So if you change the bundle ID and build without resolving again you'll end up in a bad state. If you have auto-resolution enabled in the Android Resolver it will kick off resolution after ~3 seconds to update the bundle ID in each manifest.
I have updated Android SDK and everything works fine now. Thank you.
@AlekseiBo can you share your Android SDK version, build tool version, ... I have updated Android SDK too, but problem still exist :(
I am using Mac and I have the same version as you, and it started to work after I have upgraded to Unity 2018.2
Hi any fix on this issue ? I am facing the same issue on unity2018.2.2 and Latest Firebase 5.2 sdk. Thanks
We released a new version of the Android Resolver today that may help with this https://github.com/googlesamples/unity-jar-resolver/blob/master/play-services-resolver-1.2.82.0.unitypackage
What would be really useful would be to share a sample project that is failing to build and attach the complete unity log file to the issue. We haven't been able to reproduce this issue internally with our sample applications using the 5.2.0 SDK.
I tried new version of resolver, and it still does not work. Unity 2017.4.6f1
@elusiven we need Unity's logs and a test project to see what is happening here. Saying it doesn't work is a useful, but not enough to reproduce the failure, debug and fix it.
Any chance you could reproduce the failure with one of our sample projects in this repo then share the project and the logs with us?
FYI: We just released 5.2.1 which includes the latest resolver. Please give it a try: https://firebase.google.com/support/release-notes/unity#5.2.1
If you're still having issues please post example projects and Unity logs (https://docs.unity3d.com/Manual/LogFiles.html) here.
I use Unity 5.6.5p4 with Firebase SDK 5.2.1 (Analytics, Auth, Database, Messaging, Remote Config, Dynamic Link) the problem is gone 👍
I have the problem with unity 5.6.5f1 and Firebase SDK 5.2.1. Please help to check and resolve issue. Thank you!
error log: CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="D:/android-sdk\tools" -Dfile.encoding=UTF8 -jar "E:\Unity\5.6.5\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Error: [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.1\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element: <service -- @android:exported="false" -- @android:name="com.google.firebase.components.ComponentDiscoveryService"> -- <meta-data <service ++ @android:name="com.google.firebase.components.ComponentDiscoveryService"> ++ <meta-data ++ @android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" ] stdout[ [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.appcompat-v7-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.cardview-v7-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.customtabs-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-core-ui-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-core-utils-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-fragment-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-media-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-v4-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.android.support.support-vector-drawable-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element. [Temp\StagingArea\AndroidManifest-main.xml, D:\myfolder\Temp\StagingArea\android-libraries\com.google.firebase.firebase-analytics-impl-16.1.1\AndroidManifest.xml:12] Skipping identical /manifest/application/receiver[@name=com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver] element. ] exit code: 1 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.HostView:OnGUI()
@techntt could you share a project that demonstrates the problem?
Unity 2018.2.3f1 and Firebase SDK 5.2.1. Same issue.
I have created empty project. Import FirebaseDatabase.unitypackage. Set Target Architecture to ARMv7. Off "Split APKs by target architecture". Run "Android Resolver"->"Force resolve". In console was warning message:
Some conflicting dependencies were found. The following dependency versions were modified: com.google.firebase:firebase-auth:16.0.3 --> com.google.firebase:firebase-auth:16.0.3+ com.google.firebase:firebase-common:16.0.1 --> com.google.firebase:firebase-common:16.0.0+ com.google.firebase:firebase-core:16.0.1 --> com.google.firebase:firebase-core:16.0.1+ com.google.firebase:firebase-database:16.0.1 --> com.google.firebase:firebase-database:16.0.1+
Try to build android APK: "Unable to merge android manifess". Console errors:
Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\Unity\Projects\Test\Firebase2018_08\Temp\StagingArea\android-libraries\com.google.firebase.firebase-iid-16.0.0\AndroidManifest.xml:11] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:
Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\Unity\Projects\Test\Firebase2018_08\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.1\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element:
CommandInvokationFailure: Unable to merge android manifests. C:/Program Files/Java/jdk1.8.0_91\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="D:/AndroidSDK/android-sdk_r23.0.2-windows/android-sdk-windows\tools" -Dfile.encoding=UTF8 -jar "E:\Unity\UnityHub\Editors\2018.2.1f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\Unity\Projects\Test\Firebase2018_08\Temp\StagingArea\android-libraries\com.google.firebase.firebase-iid-16.0.0\AndroidManifest.xml:11] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element: <service @android:name="com.google.firebase.components.ComponentDiscoveryService"> <meta-data -- @android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar" <service @android:name="com.google.firebase.components.ComponentDiscoveryService"> <meta-data ++ @android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" Error: [Temp\StagingArea\AndroidManifest-main.xml, E:\Unity\Projects\Test\Firebase2018_08\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.1\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element: <service @android:name="com.google.firebase.components.ComponentDiscoveryService"> <meta-data -- @android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar" <service @android:name="com.google.firebase.components.ComponentDiscoveryService"> <meta-data ++ @android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" ]
Same problem here, Unity 2018.2.5 and Firebase 5.2.1
Trying to merge incompatible /manifest/application/service[@name=com.google.firebase.components.ComponentDiscoveryService] element: