Ionic - Android authorities: FacebookContentProvider undefined in android manifest - android

Can’t install because provider name com.facebook.app.FacebookContentProviderundefined (in package io.ionic.sxxxx) is already used by io.ionic.yyyyy]"
This is listed in a few android manifest files
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider"
android:exported="true" />
on build I get
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderundefined"
android:exported="true" />
— notice the undefined ----- should I be defining something somewhere? Is there another solution? Basically I have a pair of apps that will not install at the same time on a device because this output is the same. My understanding is undefined should be my facebook id. I do have a variety of values defined in my android strings file. I have seen a few answers from a couple years ago on here (Android Facebook content provider authority) , but the solutions do not work as the files in my android directory are different as are their contents. Any help would be much appreciated!
<string name="title_activity_main">xxxx</string>
<string name="package_name">io.ionic.xxxx</string>
<string name="custom_url_scheme">io.ionic.xxxx</string>
<string name="fb_app_id">xxxxx</string>
<string name="facebook_app_id">xxxxx</string>
<string name="fb_app_name">xxxxx</string>
<string name="fb_login_protocol_scheme">fbxxxxxx</string>
<string name="fb_auto_log_app_events_enabled">true</string>
<string name="fb_advertiser_id_collection_enabled">true</string>
I have tried deleting all of the tags from all of the android manifest files, but they are generated on build. I have tried adding a string called authority in my string.xml file. I have struggeled to figure out how to implement the solutions here, as they dont exactly align with the files in my ionic project. Android Facebook content provider authority.

There is an open issue about this on GitHub:
https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/100
Did you try the temporary solutions provided in the comments?
HCJSolutions commented on Dec 10, 2021
I found a temporary solution is add ${applicationId}
modified the platforms\android\app\src\main\AndroidManifest.xml find a
node 123456789"
android:exported="true"
android:name="com.facebook.FacebookContentProvider" />
or
change it at
plugin folder plugins\cordova-plugin-facebook-connect\plugin.xml find
the line <provider
android:authorities="com.facebook.app.FacebookContentProvider${applicationId}$APP_ID"
and
apren commented on Apr 24:
Another temporary solution:
Set any APP_ID, for example APP_ID = "app_package_name" After init app
use code
facebookConnectPlugin.setApplicationId('your_facebook_app_id')

Related

Facebook Unity SDK issues when building for Android

I am not being able to solve this build-time issue when building for Android.
Here's the error message:
AndroidManifest.xml:39: Tag <provider> attribute authorities has invalid character '$'.
I found, indeed, in the AndroidManifest.xml produced in the Temp/StagingArea folder the following lines:
<!--
The initialization ContentProvider will call FacebookSdk.sdkInitialize automatically
with the application context. This config is merged in with the host app's manifest,
but there can only be one provider with the same authority activated at any given
point; so if the end user has two or more different apps that use Facebook SDK, only the
first one will be able to use the provider. To work around this problem, we use the
following placeholder in the authority to identify each host application as if it was
a completely different provider.
-->
<provider android:authorities="${applicationId}.FacebookInitProvider" android:exported="false" android:name="com.facebook.internal.FacebookInitProvider" />
It looks like the applicationId substitution is not working, but I correctly place it in the Facebook Settings, as stated in the docs.
Tried it with Facebook SDK 7.10, 7.11 and 7.12 on Unity 2017.2 and 2018.1 in an empty project with just the Facebook SDK plugin installed.
Anyone out there have any idea on what is happening here?
Try replacing this with your app id, $ returns package name not appID.
<provider android:authorities="FacebookInitProvider{APP ID HERE}" android:exported="true" android:name="com.facebook.internal.FacebookInitProvider" />

"nativescript-google-maps-sdk" PlugIn shows blank screen

I have installed nativescript-google-maps-sdk plugin in my NativeScript 2.0 project.
I generated and activated an Android API key at the Google Developer Console.
As described in the documentation of the plugin I added the string resource value nativescript_google_maps_api_key with the API key, but it does not work.
I also tried to add the google_maps_key string resource as described in the official Google documentation, so my resource file looks like this:
<resources>
<string name="google_maps_key">MY_API_KEY</string>
<string name="nativescript_google_maps_api_key">MY_API_KEY</string>
</resources>
My last try was to add a meta value to the AndroidManifest.xml file:
<manifest>
<application>
...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="MY_API_KEY" />
</application>
</manifest>
In my app.gradle file I added a reference to the com.google.android.gms:play-services-maps:8.3.0 package.
But nothings helps ... I still have a blank screen with a Google logo but no map.
I had same problem.
After I checked "Use Host GPU", it worked
Open Android Virtual Device (AVD) Manager
Select emulator and click Edit
Check Emulator Options: Use Host GPU
I was unable to run this plugin correctly, maybe it is not compatible with NativeScript 2.0.
However you could use official NativeScript plugin nativescript-geolocation or nativescript-googleMaps, which work normal on both iOS and Android.
You could read more about the plugin here: NativeScript Location
Also you could review this sample app with nativescript-googleMaps location
To upgrade the project to latest NS 2.0. run npm install tns-core-modules#latest --save
Indeed you should add this line
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KEY" />
before </application> closing tag in AndroidManifest.xml
I have followed the exact steps as shown in the demo app and it worked correctly!
Now the first thing I have noticed is that the file with your API-Key is located as follows
App_Resources/Android/values/nativescript-google-maps-api.xml
And looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nativescript_google_maps_api_key">your-api-key-here</string>
</resources>
In the map-page.xml we have
<Page xmlns="http://www.nativescript.org/tns.xsd" xmlns:maps="nativescript-google-maps-sdk" loaded="pageLoaded">
<GridLayout>
<maps:mapView latitude="{{ latitude }}" longitude="{{ longitude }}" zoom="{{ zoom }}"/>
</GridLayout>
Keep in mind that in the demo the author has passed the params via view-model but
you can always hardcore the values for latitude ,longitude and zoom for test pourposes.
And thats all that is needed in order for the plugin to work.
If you're having this problem, and everything you try does not seem to do anything, I would recommend checking your Android Logs.
adb logcat
Check for the following:
Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
This was my problem. The emulator I was using did not support the stated version of OpenGL. So I created a new emulator, checking off Use Host GPU and that seemed to cure the blank map with logo issue.
I think the Use Host GPU is the key. The old emulator I was using didn't have this option, so I couldn't verify this.

Android Studio debug/android manifest doesn't change & giving error

I worked on a android project all day today. Now I am trying to load a project into android studio. It gives me error on > debug/android manifest
even though I corrected the error . It keeps repeating the same error on same place. It looks like coding doesn't change
Error:(45) Tag attribute authorities has invalid character '#'.
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider#string/facebook_app_id"
android:exported="true" />
It automatically inserted between permissions on debug/android manifest. original manifest file has no error nor any unnecessary coding between permissions
In Android Studio, try File -> Invalidate Cache and Restart.
I'd similar problem where changes in res/AndroidManifest.xml were not being reflected in debug\AndroidManifest.xml and above step did the trick for me.
Did you checked sample project on facebook-android-sdk repo?
https://github.com/facebook/facebook-android-sdk/blob/master/samples/RPSSample/AndroidManifest.xml
Here
<provider android:authorities="com.facebook.app.FacebookContentProvider157578437735213"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
app_id is entered as hard-coded instead of string parameter. You can try this or ensure that you have "facebook_app_id" parameters in strings.xml.
It's failing because you're accessing an #string reference in the middle of the value of the authorities attribute, and references need to appear by themselves to be interpreted correctly. There are a couple approaches around this.
First, you can hardcode the facebook app id by appending it to the end of FacebookContentProvider like so (assume 22222222 is the facebook app id):
<provider android:authorities="com.facebook.app.FacebookContentProvider22222222"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
But this is not ideal if you have different facebook app ids (for example, one for development, one for staging, and one for production). To set the authorities attribute dynamically, you first need to set the specific values in your build.gradle file:
...
buildTypes {
release {
resValue "string", "facebook_content_provider_app_id", "\"com.facebook.app.FacebookContentProvider55555555555\""
}
debug {
resValue "string", "facebook_content_provider_app_id", "\"com.facebook.app.FacebookContentProvider22222222222\""
}
}
Once you have that in place, you can reference the facebook app id regardless of the build type dynamically in the AndroidManifest.xml:
<provider android:authorities="#string/facebook_content_provider_app_id"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />

google_maps_key was entered but still blank/didn't work

i use demo sample script for build google map client on android,
in ..ApiDemos\app\src\release\res\values\google_maps_api.xml
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
AIzaSyA76USspcg333E7Wh11RIkNRuuXXXXXXX
</string>
i was entered make api key like in documentations procedur step by step, but is't still not working
..\ApiDemos\app\src\main\AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo">
i use the package like on Manifest
and use the package as SHA-1 signing-fingerprint
its not just for this build app..
in other myproject also dint work
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA76USspcg333E7Wh11RIkNRuuQQPSQy6Y"/>

Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER

I am experimenting with the NotesList sample program in the Android SDK. I've made a slight variation in the program, but when I install my edited version I keep getting the message INSTALL_FAILED_CONFLICTING_PROVIDER in the console when I try to install it when the original notes program is already on the device. What do I need to change in the Provider to make it a unique database? It works fine if I uninstall the original notes program and then install my edited version.
The authority, as listed in android:authorities must be unique. Quoting the documentation for this attribute:
To avoid conflicts, authority names should use a Java-style naming convention (such as com.example.provider.cartoonprovider). Typically, it's the name of the ContentProvider subclass that implements the provider
If you have different flavors and you want to avoid collisions in the authority name you can add an applicationIdSuffix to build types and use the resulting applicationId in your manifest, like this:
<...
android:authorities="${applicationId}.contentprovider"/>
This can also happen when you have an older version of your app installed and made changes to the (support) library or the manifest file. Deleting the old applications from your device (Settings --> Application --> <your application> --> Uninstall) will solve the issue then.
If you are using Google Maps + Google Play Services inside a library project (especially if you recently migrated from Eclipse to Android Studio), you can encounter this error when you try to run an app that uses your library, while a different app that uses the same library is already installed on your device.
Fix:
make sure that defaultConfig.applicationId is defined in android section of the build.gradle file for each project using your library
android {
defaultConfig.applicationId = "com.company.appname"
}
I would recommend using the package name of the specific app. With this fix, the provider names will no longer conflict, and your app will run as expected.
Symptoms
1.) Your users are seeing the dreaded "-505" install error when installing your app from the Play Store.
2.) You will see this error message when you try to install a second app that uses your library via Android Studio [INSTALL_FAILED_CONFLICTING_PROVIDER]:
In your console, you will see a message like this:
Package couldn't be installed in /data/app/com.company.appname-1
com.android.server.pm.PackageManagerException:
Can't install because provider name
com.google.android.gms.measurement.google_measurement_service
(in package com.company.appname) is already used by
com.company.otherInstalledAppName
The fix is to make sure that defaultConfig.applicationId is defined in android section of the build.gradle file for each project using your library
android {
defaultConfig.applicationId = "com.company.appname"
}
More reading can be found here in the original bug report: Issue 784: Multiple apps using same authority provider name
If you are using the Facebook SDK then the issue might be in the "authorities" value you provide for the Facebook provider.
REPLACE -
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.FacebookContentProvider"
android:exported="true" />
WITH ->
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.FacebookContentProvider[YOUR_APP_ID]"
android:exported="true" />
You might need to change the defaultConfig.ApplicationId also as suggested in other answers.
The same error may occur after renaming packages. Check the value in string.xml for android:authorities from AndroidManifest.xml.
<provider
android:authorities="#string/content_authority"
android:name=".data.Provider"
... />
In string.xml the value should be the same as your package name, declared in manifest.
<string name="content_authority">com.whatever.android.sunshine.app</string>
Basically this happened with me, when i tried to change the package name of the app.
So, in emulator, same app was installed before. When i tried to install app after changing package name, it said, authority already used by older application in device.
Simply after uninstalling the application, it solved my problem.
Also, Authority name should always be : your.package.name.UNIQUENAME;
example :
<provider
android:name="com.aviary.android.feather.cds.AviaryCdsProvider"
android:authorities="your.package.name.AviaryCdsProvider"
/>
I have tried many solution but could not find solution... but this link helped me... I want to give detail about issue...
I was running Instrumented test cases so my app was not visible in launcher... but it was installed and thus using Same Content Provider. So, I should uninstall it somehow. So Settings -> Application Manager -> All Downloaded Apps -> uninstall all apps from your current development package
Now, try to run... This will work...
The Authority + Provider name that you have declared in the manifest probably
I had a similar problem when I used one library in several applications. It was necessary just update your AndroidManifest.xml with this exact provider declaration below.
<manifest ...>
<application ...>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.here.this.library.provider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities">
</provider>
</application>
</manifest>
I thought uninstalling the app by dragging its icon to "Uninstall" would solve the problem, but it did not.
Here is what solved the problem:
Go to Settings
Choose Apps
Find your app (yes I was surprised to still find it here!) and press it
In the top-right, press the 3 dots
Select "Uninstall for all users"
Try again, it should work now.
Stating the obvious, but also make sure you have not silently messed up the reference to the applicationId in android:authorities.
In my case I made a typo and omitted the damn dollar sign :
android:authorities="{applicationId}.myprovider"
instead of :
android:authorities="${applicationId}.myprovider"
That did not cause any immediate error (since it is a valid authority name). But a couple days later, when I tried to install different variants of an application, it was a real pain to understand what was wrong, as the error message does not give much info about what is wrong with the content providers.
Another way to troubleshoot this is to compare your merged manifests, looking for identical authorities.
If you are using Facebook inside app check for provider tag inside AndroidManifest file and check your project Id is correct for android:authorities
<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider112623702612345" android:exported="true" />
Encountered this issue.
Resolved it by:
1 - open AndroidManifest.xml
2 - ctrl+f find "provider"
3 - find provider and update your root directory name there.
run project. hopefully issue will be fixed!
If you are using the emulator, you may try the following. The below worked for me.
Go to Tools --> AVD Manager --> (Pick Your emulator) --> Wipe Data.
The error went away.
install using adb with command ./adb install -r abc.apk will solve the problem (it will overwrite even when the device has higher app version)
i had this problem :
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER
but it was not from provider of manifest
the below library in my app has conflict with other app and the others can not be install:
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.1'
I´ve got this error, when implementing an library with following AndroidmManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="library.path.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths"/>
</provider>
I solved this when i put following Code in Project AndroidManifest.xml (app/src/main):
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
</provider>
Yeah! I have the same problem as you。As you said,you use "variation". keep the "authorities" unique, you can write as this
android:authorities="${applicationId}.provider"
if you have a lib use in an app more than one,The same reason as above.
If you are on Xamarin and you get this error (probably because of Firebase.Crashlytics):
INSTALL_FAILED_CONFLICTING_PROVIDER
Package couldn't be installed in [...]
Can't install because provider name dollar_openBracket_applicationId_closeBracket (in package [...]]) is already used by [...]
As mentioned here, you need to update Xamarin.Build.Download:
Update the Xamarin.Build.Download Nuget Package to 0.4.12-preview3
On Mac, you may need to check Show pre-release packages in the Add Packages window
Close Visual Studio
Delete all cached locations of NuGet Packages:
On Windows, open Visual Studio but not the solution:
Tools -> Option -> Nuget Package Manager -> General -> Clear All Nuget Cache(s)
On Mac, wipe the following folders:
~/.local/share/NuGet
~/.nuget/packages
packages folder in solution
Delete bin/obj folders in solution
Load the Solution
Restore Nuget Packages for the Solution (should run automatically)
Rebuild
You can uninstall package name "com.example" from the device in which you run the app after than you run the app . This worked for me
It helped me: Go AndroidManifest and paste or replace with this code
<provider
android:authorities="${applicationId}.here.this.library.provider"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities" >
</provider>
if your are using provider check and do it by following method
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="androidx.multidex.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_path" />
</provider>
or use it
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.contentprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_path" />
</provider>
also if the applciation already exits in your mobile uninstall and then check
In my android device I had different flavors of the same app install. This gives me error INSTALL FAILED CONFLICTING PROVIDER.
so I uninstall my all flavors of the same app.
and tried
adb install -r /Users/demo-debug-92acfc5.apk
It solved my problem.
need to use android:name="androidx.core.content.contentprovider
or android:name="androidx.core.content.provider insteadof
android:name="androidx.core.content.fileprovider
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.contentprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/filepaths" />
</provider>
Solution 1
Run the app on a physical device instead of the emulator. I encountered this issue and my app didnt have a content provider defined.
Solution 2
In the other instance, i had an instrumented test app installed matching the same applicationId.
To fix the issue i had to run ./gradlew uA - uA short for uninstallAll task.
You can alternatively use the Gradle panel and choose navigate to app\install\uninstallAll task
If you using an emulator, you can wipe out the data
If you are using Audience Network Content Provider you need to add this code in your app AndroidManifest.xml
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider165632208074623"
android:exported="true" />
Your Facebook app id ---> 165632208074623
If you only need to use facebook for sign in to your app here is a tip:
(this fix worked in cordova project)
Step 1 and 2 must be completed to fix the problem.
1.
locate the file: platform/android/android.json
inside that file:
remove this code:
,{"xml": "<provider android:authorities=\"com.facebook.app.FacebookContentProvider<FACEBOOK_APP_ID>\" android:exported=\"true\" android:name=\"com.facebook.FacebookContentProvider\" />","count": 1
}
Then locate file: platforms/android/app/src/main/androidManifest.xml
remove this code:
<provider android:authorities="com.facebook.app.FacebookContentProvider<FACEBOOK_APP_ID>" android:exported="true" android:name="com.facebook.FacebookContentProvider" />
Now the application can run fine..
Im sorry if this answer is not relevant for the OP, but it may help many others that have this problem. I could not find this exact answer anywhere else.
I tried many solutions but couldn't find a solution:
I changed this in AndroidManifest
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.com.shareFile"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>
Make the authorities changes as said by #Jose L Ugia.
(You can find the provider in the manifest(merge manifest))
Mostly it will be connected to an SDK that you implemented, So remove the SDK implementation line and sync the Gradle, and then again add the implement line and sync the Gradle.
The implementation line:
implementation files(<your SDK>)
Provider code: (you have to scroll down in merge-manifest to find it )

Categories

Resources