Before everything: ionic serve works as expected and the problem occurs only when the project is built for android.
I have an ionic 1 android application currently in Google Playstore, and recently wanted to update the app and release in the playstore. When submitting a new apk I got the prompt by playstore that my current app is using a minimum supported api which is 19 and needs to be updated to 22 to be released. So i have changed the config.xml minSdkVersion from 19 to 22 (refer below for the code) and after that I started to get the following errors in my application when running the app on the emulator or device, take note that the build is successful (refer to the screenshot).
Before:
<preference name="android-minSdkVersion" value="19" />
Now:
<preference name="android-minSdkVersion" value="22" />
I have tried to research the problem and saw a suggestion to add the following line (refer below) into config.xml as well, but nothing changed.
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
I also tried to start a completely new blank project on ionic 1 and build to apk to eliminate any issues with development setup and it builds and works as expected
I assume that the issue is that my project does not build properly based on the errors I receive however I am not able to find the exact cause. All the relevant files are attached, hope for any input to eliminate the errors that prompt during the build
my config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="test.test.test.test" version="1.1.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:tools="http://schemas.android.com/tools">
<name>test</name>
<description>
test
</description>
<author email="test" href="http://example.com.com/">
test
</author>
<content src="index.html" />
<access origin="*" />
<preference name="android-minSdkVersion" value="22" />
<preferance name="android-usesCleartextTraffic" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="SplashScreenDelay" value="4500" />
<preference name="FadeSplashScreenDuration" value="750" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreen" value="screen" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<platform name="android">
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
<preference name="loadUrlTimeoutValue" value="700000" />
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
<icon src="resources\android\icon\drawable-xhdpi-icon.png" />
<allow-navigation href="http://quotes.wsj.com/" />
<allow-navigation href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<plugin name="cordova-plugin-console" spec="^1.0.7" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-facebook" spec="^0.2.2">
<variable name="FACEBOOK_DISPLAY_NAME" value="test" />
<variable name="FACEBOOK_APP_ID" value="test" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<allow-navigation href="http://192.168.0.116:8100" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
</edit-config>
<plugin name="cordova-plugin-x-toast" spec="^2.7.2" />
<plugin name="cordova-plugin-admob-free" spec="^0.27.0">
<variable name="ADMOB_APP_ID" value="test" />
</plugin>
</widget>
my package.json
"name": "test",
"version": "1.1.1",
"description": "test",
"dependencies": {
"@angular/animations": "^5.2.8",
"bower": "^1.8.8",
"cordova-admob-sdk": "^0.24.1",
"cordova-browser": "^6.0.0",
"cordova-plugin-admob-free": "^0.27.0",
"cordova-plugin-androidx": "^2.0.0",
"cordova-plugin-androidx-adapter": "^1.1.1",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-enable-multidex": "^0.2.0",
"cordova-plugin-facebook": "^0.2.2",
"cordova-plugin-firebase-analytics": "^4.3.0",
"cordova-plugin-firebase-dynamiclinks": "^4.4.0",
"cordova-plugin-firebasex": "^9.1.2-cli",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-toast": "^2.7.2",
"cordova-promise-polyfill": "0.0.2",
"cordova-support-android-plugin": "^1.0.2",
"cordova-support-google-services": "1.4.0",
"gulp": "^3.5.6",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.2.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^3.1.0",
"ionic-plugin-keyboard": "^2.2.1",
"ng-cordova-oauth": "^0.3.0",
"node-sass": "^5.0.0",
"shelljs": "^0.8.3"
},
"platforms": [
"android"
],
"cordova": {
"platforms": [
"browser",
"android"
],
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-facebook": {
"FACEBOOK_DISPLAY_NAME": "test",
"FACEBOOK_APP_ID": "test"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-x-toast": {},
"cordova-plugin-admob-free": {
"ADMOB_APP_ID": "test"
},
"cordova-support-google-services": {},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true"
},
"cordova-plugin-enable-multidex": {},
"cordova-plugin-firebase-dynamiclinks": {
"PAGE_LINK_DOMAIN": "vindexscreener.page.link",
"FIREBASE_DYNAMIC_LINKS_VERSION": "19.1.+"
},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
}
}
},
"devDependencies": {
"@ionic/v1-toolkit": "2.0.17",
"cordova-android": "^9.0.0",
"cordova-plugin-ionic-webview": "^4.2.1",
"ionic": "5.4.16"
}
}
