Android App Manifest merger failed Facebook and Firebase - android

I'm working on a social app (Facebook and Firebase).
Once I added the firebase gradle path, I got this error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.facebook.FacebookActivity#theme value=(#android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:85:13-72
is also present at [com.firebaseui:firebase-ui-auth:0.6.0] AndroidManifest.xml:69:13-58 value=(#style/FirebaseUI.Translucent).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:81:9-85:75 to override.
build.gradle file:
compile 'com.firebaseui:firebase-ui:0.6.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
Mainfest 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="com.friendture.apps.android.friendture">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:name=".Init"
android:allowBackup="true"
tools:replace="android:theme"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="*****" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="******" />
<activity android:name=".Activity.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity.ProfileActivity"
android:label="#string/title_activity_profile" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:name=".Activity.PasswordActivity" />
<activity android:name=".Activity.SelectFromListActivity" />
<activity android:name=".Activity.CompleteFacebookActivity"></activity>
</application>

Ever since we added firebase-ui-auth to our project, this error has shown up and if it's not properly fixed, causes facebook activity to crash !
To fix it, update the manifest (notice the new "tools" attribute):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="YOUR_PACKAGE">
<!-- Facebook API Key -->
<meta-data
tools:replace="android:value"
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait"/>

The combination of two earlier answers by Nayan Srivastava and MhmdAljobairi worked for me:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
tools:replace="android:value"
android:value="#string/facebook_app_id"
/>

As hint is already there in logcat response, just add 'tools:replace="android:theme"' to your application node in manifest and you are good to go.

Related

How can I fix android gradle build making strange error

I made a file manager app and now I am trying to build it to an APK. The problem is that every time I try to build it returns this error:
error: failed processing manifest.
here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:requestLegacyExternalStorage="true"
android:label="FileManager"
android:supportsRtl="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/Theme.FileManager"
tools:targetApi="31">
<activity
android:name=".FileListActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<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>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>
I tried everything, I found similar questions in the internet but none of them works for me, can someone please help.

Contradictory error when using MobileAds in an Android app

I am somewhat confused by an error showing up in an Android app, where I want to use MobileAds.
Here is the Kotlin code:
val adRequest = AdRequest.Builder().build()
adView.loadAd(adRequest)
The AndroidManifest.xml file contains these three lines:
<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" />
And these are the errors I get:
Missing permissions required by BaseAdView.loadAd: android.permission.INTERNET
Missing permissions required by FusedLocationProviderClient.getLastLocation: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
Is there anyone out there who has an idea of what is going on?
Any relevant tip or explanation would be more than welcome.
Just in case this is the complete 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="me.soft.app">
<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" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.App"
tools:targetApi="31">
<activity
android:name=".WorldExposureActivity"
android:exported="false"
android:parentActivityName=".ShopDetailActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="XXXXXXX" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-1234567890012345~1234567890"/>
<activity
android:name=".ShopMapActivity"
android:exported="false"
android:label="#string/title_activity_shop_map"
android:parentActivityName=".MainActivity" />
<activity
android:name=".ShopDetailActivity"
android:exported="false"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".MainActivity"
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>
</application>
</manifest>

Error:Execution failed for task ':app:processDebugManifest'. after adding new Activity

I have been coding my app for a couple of days without any problems until I tried to add a new activity which has triggered this error: Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:design:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.
Manifest code: I never changed the code bellow other than changing the starting activity which worked fine, after that I added a new activity and that is caused the issue
<?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="uk.ac.abertay.contactslist">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Android Project"
android:supportsRtl="true"
android:theme="#style/AppTheme">
I added the tools:replace="android:value" like the error suggested but this hasn't changed anything
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBkvfvE19LM1FDGhHrOkt17Kd17JX7RZDI"
tools:replace="android:value" />
I've tried putting the tools replace line in both of the meta datas and tried having it in one or the other
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"
tools:replace="android:value"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
activities
</activity>
<activity android:name=".ContactsListActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SMSActivity" />
<activity android:name=".MapsActivity" />
<activity android:name=".Maps2Activity" />
<activity android:name=".NewItemActivity" />
<activity android:name=".Item_listActivity" />
<activity android:name=".MyItemsActivity"></activity>
</application>
I updated my android studio and SDK tools and that fixed it

Getting error when trying to generate signed APK

I am trying to generate a signed APK for my app, however, i am getting two of the below error messages. Please see my Android Manifesto file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.elderlywatch.elderlywatch">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:name=".FallDetectorSettings.SettingValues"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat">
<activity
android:name=".HomeActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HRDetailsActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" />
</activity>
<activity android:name=".UserActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".FallDetectHomeActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".ContactDetailsActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".FallDetectSettingActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait"/>
<activity
android:name=".MonitoringFallActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".SMSSendActivity"
android:screenOrientation="portrait" />
<service android:name=".FallDetectorAccelerometer.DetectingFalls" >
</service>
<activity
android:name=".SMSDetailsActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait"></activity>
</application>
</manifest>
I am getting the below two error messages and please can someone help me as I am struggling to generate a singed APK. I am able to build my app, however, when trying to create a API I always get the two error messages indicated below.
Error:Execution failed for task
':mobile:transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
The error:
\AndroidManifest.xml Error:(48) Error: The element must be a direct
child of the root element [WrongManifestParent] Error:Execution failed
for task ':mobile:lintVitalRelease'.
This indicates that you need to look at line 48 of your manifest.xml
That line looks like:
<application
android:name=".ApplicationState"
android:label="#string/app_name" />
That's a second xml <application> tag.
It tells you that tag must be a direct child of the root.
Probably just remove it and it will work.
Remove this
<application
android:name=".ApplicationState"
android:label="#string/app_name" />
and add this
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
**android:name=".ApplicationState"**
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:name=".FallDetectorSettings.SettingValues"
android:label="#string/app_name"
android:screenOrientation="portrait"
in your gradle (app) inside android{} place this
lintOptions {
checkReleaseBuilds false
}
for dex error follow the solution given by android in the below link:
https://developer.android.com/studio/build/multidex.html

Getting MALFORMED error in android

This is my manifest file and I don't know why am I getting this error . Please help me out with this error. Everything is working fine, but the problem is the meta tags inside the applciation tags, if I write them outside the application tags then it crashes the app, and if I write them inside the application tags then I get the error "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED".
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nadeemahmad.guitest">
<!--Permissions-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission android:name="com.example.nadeemahmad.guitest.MAPS.RECIEVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.nadeemahmad.guitest.MAPS.RECIEVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permissions.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x0020000" android:required="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".splash"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:noHistory="true" />
<activity
android:name=".profile"
android:noHistory="true" />
<activity
android:name=".profile_update"
android:noHistory="true" />
<activity
android:name=".sync_contacts"
android:noHistory="true" />
<activity
android:name=".settings"
android:noHistory="true" />
<activity android:name=".synced_contacts_list"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_android_map_api_key" />
<meta-data android:name="come.google.android.gms.version"/>
</application>
</manifest>
Rectify Your meta-data TAG . It should be com instead of come .
Wrong
<meta-data android:name="come.google.android.gms.version"/>
Perfect
<meta-data android:name="com.google.android.gms.version"/>
After that Clean-Rebuild and Run .

Categories

Resources