Android compulsory update in the project, when the file is downloaded. The apk package cannot be opened in android 8.0.
Introduce the plug-in to report the error
import { FileOpener } from '@ionic-native/file-opener'; constructor(private fileOpener: FileOpener) { } ... this.fileOpener.open('path/to/file.pdf', 'application/pdf') .then(() => console.log('File is opened')) . catch (e => console.log('Error opening file', e));
FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()
========================================
According to cordova’s official website, android 8.0 needs to add a configuration file.
Android APK installation restrictions When opening the APK file for installation, the following restrictions apply: In Android 8 + on, your application must have ACTION_INSTALL_PACKAGE permission. You can add it by adding it to your application config.xml file: <platform name= " android " > <config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> </config-file> </platform> Before Android 7, you could only install APKs from the "external" partition. For example, you can install cordova.file.externalDataDirectory from it, but not cordova.file.dataDirectory from it. Android 7 + does not have this limitation.
After adding the above content, it still reports an error.
Solution:
The above is the answer of the great god. Finally modify in AndroidManifest.xml
1
|
<uses-sdk android:minSdkVersion= "16" android:targetSdkVersion= "23" /> |
The default configuration of ionic3 is 16-26. After many trials, only the direct sdk version of 16-23 is supported. The higher the version, the above error will be reported.
Solve the problem of packaging again! ! !
Read More:
- Android 10 open file exception open failed: eacces (permission denied) android:requestLegacyExternalStorage= “true“
- [Solved] Android-android studio apk Install Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
- [Solved] Android Studio Compile Error: Invalid main APK outputs : EarlySyncBuildOutput
- [Solved] Android Studio APK install Error: INSTALL_FAILED_CONFLICTING_PROVIDER
- Android Studio: How to Solve APK error in mobile phone installation
- [Solved] Android app development version update failed, Android – error: task execution failed ‘: app: com
- [Solved] Android Studio Generate APK Error: error_prone_annotations.jar (com.google.errorprone:error)
- Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment
- Windows update failed to update, indicating the solution of 0x80244021
- APK Install Error: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
- [Solved] Android Studio Start Error: Missing essential plugin: org.jetbrains.android Please reinstall Android
- Apk Failed to install Error: [install\u failed\verification\u failure]
- [Solved] ionic Build Error: Cannot load gulp tasks: Error: Error in module: .\gulpfile.js:
- [Solved] Appium Install Error: Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variab
- Using Jenkins to compile APK Error [How to Solve]
- [Solved] Unity packaged and exported apk error: Failed to load libmain.so’
- [Solved] Flutter package flutter build apk Error: permission-handle
- [Solved] Android Error: import android.support.annotation.NonNull
- Android Error: Failure [INSTALL_FAILED_USER_RESTRICTED: Invalid apk] in android