I am using an open-srouce code from Google for an app called MyTracks.
I am getting this error when the original app is installed on the phone.
INSTA
The gradle also needs to contain this
defaultConfig {
applicationId "com.example.app"
}
I had left it out completely
The android :authorities value is the package name.
In this case, it happens to be the package name. It simply has to be unique.
The android:name is the name of the class of that provider
Correct.
If I change the package name, to another one different than the com.google etx, and rename all the references/ imports of that package, should the problem go away?
The package name has nothing to do with it. You may need to change that as well, though, for your app to be able to be installed alongside the regular, un-modified app.
You need to have a unique value for android:authorities
, and the code in your app that uses this ContentProvider
needs to use an appropriate Uri
(content://whatever.you.change.the.authority.to/...
).
may be your phone memory is full so please check it
if you use for ex facebook-sdk then for each app you need unique this line in manifest
<provider android:authorities="com.facebook.app.FacebookContentProviderxxxxxxxxxx"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
xxxxxxxxxx - should be unique for each app, for facebook-sdk it's your facebook_id number
You maybe compile same library or including libraries. For example :
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
Above code, google play services (first line ) includes all other services .
CommonsWare has it right, however, there are more details that may help.
For me, there were two key parts of the solution. First I added $(applicationId) to Manifest provider entry:
<provider
tools:replace="android:authorities"
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/fileprovider" />
</provider>
Second, when you switch Build Varients, and for me this is between 'debug' and 'release', you also need to Sync Project with Gradle Files. It was not enough to just Clean and Rebuild project.
In Android Studio there are two tabs in the bottom of the AndroidManifest.xml page. The 'Text' tab you use to edit and the 'Merged Manifest' tab shows the resulting manifest after the build, and for me I can see it was injecting the applicationId properly into the android:authorities section of the provider.