Android-RTEditor
Android-RTEditor copied to clipboard
Bug: failure to build because of FileProvider being incorrectly set
v1.6.7
In the manifest of the library, it has a constant :
android:authorities="com.onegravity.rteditor.fileprovider"
This means, that if I create 2 projects that use this library, and install one, I won't be able to install the other, because of a conflict. And, indeed, the IDE tells me I can't do it:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.example.user.myapplication2-6ioDf0xDgtsWcK3dYn3jKw==: Can't install because provider name com.onegravity.rteditor.fileprovider (in package com.example.user.myapplication2) is already used by com.example.user.myapplication]
Error while Installing APK
Attached 2 sample projects, with identical code yet different package names. In fact, all I did is adding the dependency of the library to both of them. Try to install both on the same device. You will get the error.
I agree with AndroidDeveloperLB.
With
android:authorities="com.onegravity.rteditor.fileprovider"
in the libraries manifest it is not possible to install an App with the RTEditor library if there already is another App with this library installed (e.g. the RTEditor Demo App).
Overriding android:authorities in the own manifest with another name is not a solution because then picking a camera image does not work any more.
However, I think there is an easy solution. Replace "com.onegravity.rteditor.fileprovider" with ${applicationId}"
In the libraries manifest use:
android:authorities="${applicationId}"
And in ImageChooserManager.java use:
uriForCamera = FileProvider.getUriForFile(mActivity, BuildConfig.APPLICATION_ID, imageFile);
kindly merge this branch so that your library can be used by adding in build.gradle