Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Seems to fix a NullPointerException on Android 8.0+ built with API 28 #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,26 @@
-->

<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<preference name="ANDROID_SUPPORT_V4_VERSION" default="27.+"/>
<config-file target="config.xml" parent="/*">
<feature name="SitewaertsDocumentViewer">
<param name="android-package"
value="de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin"/>
</feature>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
</config-file>

<!--see http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed-->
<!--see https://github.com/sitewaerts/cordova-plugin-document-viewer/issues/105-->
<framework src="com.android.support:support-v4:27+" />

<config-file target="AndroidManifest.xml" parent="/manifest/application">

<provider
<config-file target="AndroidManifest.xml" parent="application">
<provider
android:name="de.sitewaerts.cordova.documentviewer.FileProvider"
android:authorities="$PACKAGE_NAME.DocumentViewerPlugin.fileprovider"
android:authorities="${applicationId}.DocumentViewerPlugin.fileprovider"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this from $PACKAGE_NAME to ${applicationId}? Is that change relevant to fix the issue?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@regnete This will be help full if you have multiple variants(dev, staging prod) for your app and you want to install all the builds simultaneously. Then applicationId will help or else it will throw the following error
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.:

android:exported="false"
android:grantUriPermissions="true">
<meta-data
Expand All @@ -59,7 +58,7 @@
target-dir="res/xml"/>

<source-file
src="src/android/de/sitewaerts/cordova/documentviewer/FileProvider.java"
src="src/android/de/sitewaerts/cordova/documentviewer/FileProvider.java"
target-dir="src/de/sitewaerts/cordova/documentviewer"/>

<source-file
Expand Down