Skip to content

Commit

Permalink
Fix installation error caused by incorrect FileProvider in manifest #160
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuel Moecklin committed Oct 7, 2021
1 parent bb43676 commit b8a79f7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,18 @@ Setup
Add this to your Gradle build file:
```
dependencies {
compile 'com.1gravity:android-rteditor:1.6.7'
compile 'com.1gravity:android-rteditor:1.7.0'
}
```

#### Manifest

Add these two Activity definitions to your manifest:
Add this to your manifest:
```
<activity
android:name="com.onegravity.rteditor.media.choose.MediaChooserActivity"/>
<activity
android:name="com.onegravity.rteditor.media.crop.CropImageActivity"/>
<provider
android:name="androidx.core.content.FileProvider"
tools:replace="android:authorities"
android:authorities="${applicationId}.provider"/>
```

#### Proguard
Expand Down
13 changes: 7 additions & 6 deletions RTEditor-Demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.onegravity.rteditor.demo">

<supports-screens
Expand All @@ -25,7 +26,8 @@
android:smallScreens="true"
android:xlargeScreens="true" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />

<application
android:name="com.onegravity.rteditor.demo.RTApplication"
Expand Down Expand Up @@ -54,11 +56,10 @@

</activity>

<activity
android:name="com.onegravity.rteditor.media.choose.MediaChooserActivity"/>

<activity
android:name="com.onegravity.rteditor.media.crop.CropImageActivity"/>
<provider
android:name="androidx.core.content.FileProvider"
tools:replace="android:authorities"
android:authorities="${applicationId}.provider"/>

</application>

Expand Down
11 changes: 8 additions & 3 deletions RTEditor/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@
android:versionName="1.0">

<application>
<activity
android:name="com.onegravity.rteditor.media.choose.MediaChooserActivity"/>

<activity
android:name="com.onegravity.rteditor.media.crop.CropImageActivity"/>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.onegravity.rteditor.fileprovider"
android:name="androidx.core.content.FileProvider"
android:authorities="com.onegravity.rteditor.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>

</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private boolean takePicture() {
// There are compatibility issues with FileProvider Uris on lower versions
uriForCamera = Uri.fromFile(imageFile);
} else {
uriForCamera = FileProvider.getUriForFile(mActivity, "com.onegravity.rteditor.fileprovider", imageFile);
uriForCamera = FileProvider.getUriForFile(mActivity, mActivity.getPackageName() + ".provider", imageFile);
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE)
.putExtra(MediaStore.EXTRA_OUTPUT, uriForCamera);
Expand Down

0 comments on commit b8a79f7

Please sign in to comment.