Manifest Merger Failed When Trying to Update to Latest FirebaseUI - java

I am trying to add the latest FirebaseUI dependency to my Android project. I have Facebook login enabled in my project, and when I set up the Facebook login I was required to add my Facebook App ID in the Android manifest. Here is the dependency I added to my android project:
"com.firebaseui:firebase-ui:3.0.0"
After compiling, I received the following error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#com.facebook.sdk.ApplicationId#value value=() from AndroidManifest.xml:29:13-52
is also present at [com.firebaseui:firebase-ui-auth:3.0.0] AndroidManifest.xml:21:13-60 value=().
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:27:9-29:55 to override.
I am not sure why I am being prompted to change my Facebook App ID in order to use the latest library. I am updating so that I can take advantage of the new FirebaseUI features and Firebase Cloud Firestore as well.
Manifest
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#drawable/xxxxxxx"
android:label="#string/xxxxxxx"
android:theme="#style/AppTheme.NoActionBar"> <!-- ADD THIS LINE -->
<activity
android:name=".SignupActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
tools:replace="android:theme" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<meta-data
android:name="com.firebase.ui.GoogleClientId"
android:value="#string/google_client_id" />
<meta-data
android:name="com.firebase.ui.TwitterKey"
android:value="#string/twitter_app_key" />
<meta-data
android:name="com.firebase.ui.TwitterSecret"
android:value="#string/twitter_app_secret" />
<activity
android:name=".PollHostActivity"
android:label="#string/title_activity_poll"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".LoadingActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HomeActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CreateActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".NewImageActivity"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<activity
android:name=".ProfileActivity"
android:label="#string/title_activity_profile"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>

Your post says: when I set up the Facebook login I was required to add my Facebook App ID in the Android manifest. That is not the case for firebase-ui-auth:3.1.0 and may not be for 3.0.0 either. With 3.1.0, you define the IDs as string resources, as described here, and FirebaseUI generates the needed manifest entries, which get merged into the main manifest at build time. If you are defining the constants in your manifest manually, that is likely the cause of the merge conflict.
To see the contributors to the merged manifest, open your AndroidManifest.xml file in Android Studio. Click the Merged Manifest tab at the bottom of the window. In the right pane, find and click on firebase-ui-auth:3.0.0 to see the manifest entries that are generated by FirebaseUI for merging into the composite manifest. If you see meta-data entries there that you have manually entered into your manifest, delete your entries to eliminate the merge conflict.

Try following their GitHub readme, located here. I was having the same problem as well and my question got a lot of attention but unluckily none could pin point the problem. The problem lies somewhere in the gradle file where you are writing this "com.firebaseui:firebase-ui:3.0.0".

Related

No internet permission but the permission is given, when i intilize the admob banner (it give a red underlying saying i dont have permission)

I get this missing "Missing permissions required by BaseAdView.loadAd: android.permission.INTERNET" when i copy pasted the meta tags that are needed for the google maps sdk, without them it doesn't show the error. What could be the issue and the fix?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="*******">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.SmartQ">
<activity
android:name=".mapp"
android:exported="false" />
<activity
android:name=".sdkmaps"
android:exported="false" />
<activity
android:name=".map"
android:exported="false" />
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow the directions here:
https://developers.google.com/maps/documentation/android-sdk/get-api-key
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Web_view"
android:exported="false" />
<activity
android:name=".Update1"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="*******" />
</application>
</manifest>
picture
The problem is that android is unable to resolve ${MAPS_API_KEY}.
The easiest fix is replacing ${MAPS_API_KEY} with real key directly in manifest, something like:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBdJ88HN7LTGkHHK5whfaVv8a5ozlx2E_k" />
If you anyway want to store your key in .properties file, follow this answer:
How to store maps api key in local.properties and use it in AndroidManifest.xml

I set android:exported but I am still getting error: android:exported needs to be explicitly specified for <receiver>

I am moving from SDK version 30 to 31 and I add android:exported in intent-filter but still I am getting this error:
Merging Errors: Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mycompany.webviewapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity android:name="com.mycompany.webviewapp.SplashActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.mycompany.webviewapp.MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW"></action>
</intent-filter>
</activity>
<service android:name="com.mycompany.webviewapp.FCM.MyFirebaseMessagingService">
</service>
<meta-data android:name="applovin.sdk.key"
android:value="sdk api here"/>
</application>
</manifest>
The reason is because some of the dependency libraries that you're using have elements which do not have "android:exported" attribute.
You need to do this:
Lower the version in your gradle to 30 and sync and build.
Go to your AndroidManifest.xml file and click on "Merged Manifest".
Find items such as Activity, Receiver, Service, etc that don't have "android:exported" attribute.
Then add them to your AndroidManifest.xml file in this way.
<activity
android:name="SomeActivity"
android:exported="false"
tools:node="merge"
tools:replace="android:exported" />
Now you can increase your version to 31.
I resolve my issue. I just check the merged manifest and look for reciver. In onesignal, I found out reciver with intent filter defined without android:exported. I just add android:exported="false".

"Default activity not found"

I keep getting the "Default activity is not found" error whenever I want to try and run my app. I have tried 'clean project', 'invalidate caches/restart' and restarted my computer.
UPDATE: I tried running different projects, but they all give the same error too. This makes me think there must be something wrong with settings.
It works perfectly for my friend, but I get the error that the "Default activity is not found". If I try to launch a specific activity it also says the activity is not found. This is the code in the androidmanifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ek97.fhict.theapp">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission. ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/loqate_logo"
android:label="#string/app_name"
android:roundIcon="#drawable/loqate_logo"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".bottomnavigationfinal"
android:label="#string/title_activity_bottomnavigationfinal"/>
<activity android:name="Settings" />
<activity
android:name=".Login"
android:label="#string/title_activity_login" />
<activity
android:name=".Registration"
android:exported="true"
android:label="#string/title_activity_registration" />
<activity android:name=".Navigation" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<activity
android:name=".GoogleMaps"
android:label="#string/title_activity_google_maps" >
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
</activity>
<activity android:name=".Profile" />
</application>
</manifest>
If it works for your friend and it is the same code it could be that all you need to do is to refresh the cache of your IDE:
File -> Invalidate Caches / Restart
Try this::
Your manifest is missing default activity
Add to any activity as you consider a default activity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
I finally solved it by making sure all implementation versions were the same, there were some in a 28.0.0 version and others in a 26.1.0. version. Now the app works fine on the emulator. Thanks for your suggestions though

Android Studio 2.3.3 won't load class file from JAR

I've copied a jar file into my project's libs folder. Usually it will show me all of the files contained therein. For this one JAR file, it won't display the class file embedded inside, but does display a manifest file.
Let's say the jar is custom-unity-activity.jar and the directory structure is com\custom\activity\custom-unity-activity.class. As far as Android Studio gets is "com.custom" and then goes no further. The compiler also can't resolve symbols defined in the class file, so it definitely isn't reading it in.
I know this jar file is valid, because it has been used successfully under a different build environment.
It's really hard to import Unity's project into an existing Android Project. The solution is to do it the other way around instead.
Build the Android Studio project as to jar or .arr plugin then place in your Unity project at: <ProjectName>Assets\Plugins\Android.
If you want to load your Android Studio project activity, you must modify the AndroidManifest.xml to let Unity know that then place it at:<ProjectName>Assets\Plugins\Android.
Below is what the XML should look like. It will specify the activity name to load and will also tell Unity to allow you to use input events from your Android Studio project otherwise, Unity will steal those events. The manifest below assumes that the Android Studio activity name is "MainActivity".
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.casualcoder.plugin" android:installLocation="auto">
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
<application android:icon="#drawable/app_icon" android:label="#string/app_name">
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:screenOrientation="landscape">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:screenOrientation="landscape">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
</application>
</manifest>

Android can't extend Firebase Messaging Service

I am trying to implement Firebase Cloud Messaging in my application, I had implemented all settings to use this service, but when I try to extend FirebaseMessagingService in my class it gives me error and it can't find it at all, I can't even import com.google.firebase.messaging.FirebaseMessagingService as shown in the picture:
I had added all the code required:
I added this to app gradle
compile 'com.google.firebase:firebase-core:9.4.0'
apply plugin: 'com.google.gms.google-services'
and this to the module gradle:
classpath 'com.google.gms:google-services:3.0.0'
this is the manifest code:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
and I added the google json file to the app.
So if anybody can help me please
If you want to use messaging, you have to add the messaging module. Right now you only added the core module.
So go ahead and include
compile 'com.google.firebase:firebase-messaging:9.4.0'
All the available modules can be found at the bottom of https://firebase.google.com/docs/android/setup

Categories

Resources