I have just modified my app’s config.xml to try and conform with the upcoming Google PlayStore requirement to support Android 12 as detailed on the VoltBuilder website.
I have been reading Building for Android 12 and did several things to my app, which had worked perfectly well beforehand.
I included the engine element as per the recommendations.
I removed all my icon and splash screen entries and put in the elements for VoltBuilder to do it, again as per recommendations.
I took out the whitelist plugin.
I put in the required files in the top level resource folder of the zip file as follows.
iconTemplate.png
splashTemplate.png
resources.json
This is the contents of resources.json.
{
"fit": "contain",
"icon-background-source": "#062342",
"orientation": "portrait",
"position": "center"
}
I then deleted from the resources folder all the various png files that used to be included for specific splashscreen and icon sizes.
Submitting the rebuilt zip to VoltBuilder results in a successful release app, but when I try and side load the downloaded apk onto a physical device, I get the message “App not installed as package appears to be invalid”.
I checked the log file, but cannot see any errors except for those referring to adaptive icons. I haven’t made any provision for adaptive icons. There are no files in the zip for it and no config.xml elements that relate to adaptive icons, so this is all very confusing.
I would be very grateful if you could have a look at the extract from the build log that contains the error messages, below, and point out where I might have gone wrong.
2022-10-12 12:23:34,794 - Output: 2022-10-12T12:23:33.525Z cordova-res Paths: (config: '/config.xml') (resources dir: 'resources')
2022-10-12T12:23:33.533Z cordova-res:platform Running android platform with options: {
'adaptive-icon': {
icon: { sources: [Array] },
foreground: { sources: [Array] },
background: { sources: [Array] }
},
icon: {
sources: [
'/resources/iconTemplate.png'
]
},
splash: {
sources: [
'/resources/splashTemplate.png'
]
}
}
2022-10-12T12:23:33.533Z cordova-res:platform Building adaptive-icon resources
2022-10-12T12:23:33.533Z cordova-res:platform Building icon resources for android platform
2022-10-12T12:23:33.542Z cordova-res:image Source image for icon: {
format: 'png',
size: 75122,
width: 1024,
height: 1024,
space: 'srgb',
channels: 4,
depth: 'uchar',
density: 96,
isProgressive: false,
hasProfile: false,
hasAlpha: true
}
2022-10-12T12:23:33.542Z cordova-res:platform Using '/resources/iconTemplate.png' for icon source image for android
2022-10-12T12:23:33.544Z cordova-res:image Generating 'resources/android/icon/drawable-ldpi-icon.png' (36x36) fit='contain' position='center'
2022-10-12T12:23:33.545Z cordova-res:image Generating 'resources/android/icon/drawable-xxxhdpi-icon.png' (192x192) fit='contain' position='center'
2022-10-12T12:23:33.546Z cordova-res:image Generating 'resources/android/icon/drawable-xxhdpi-icon.png' (144x144) fit='contain' position='center'
2022-10-12T12:23:33.546Z cordova-res:image Generating 'resources/android/icon/drawable-mdpi-icon.png' (48x48) fit='contain' position='center'
2022-10-12T12:23:33.547Z cordova-res:image Generating 'resources/android/icon/drawable-xhdpi-icon.png' (96x96) fit='contain' position='center'
2022-10-12T12:23:33.585Z cordova-res:image Generating 'resources/android/icon/drawable-hdpi-icon.png' (72x72) fit='contain' position='center'
2022-10-12T12:23:33.607Z cordova-res:image Source file missing: resources/android/icon-foreground.png
2022-10-12T12:23:33.607Z cordova-res:image Source file missing: resources/android/icon-foreground.jpg
2022-10-12T12:23:33.607Z cordova-res:image Source file missing: resources/android/icon-foreground.jpeg
2022-10-12T12:23:33.608Z cordova-res:platform Error with adaptive icons: Error
at new BaseError (/usr/lib/node_modules/cordova-res/dist/error.js:8:22)
at new ResolveSourceImageError (/usr/lib/node_modules/cordova-res/dist/error.js:45:9)
at Object.resolveSourceImage (/usr/lib/node_modules/cordova-res/dist/image.js:31:11)
at async generateAdaptiveIconResourcesPortion (/usr/lib/node_modules/cordova-res/dist/platform.js:190:20)
at async generateAdaptiveIconResources (/usr/lib/node_modules/cordova-res/dist/platform.js:148:74)
at async safelyGenerateAdaptiveIconResources (/usr/lib/node_modules/cordova-res/dist/platform.js:128:16)
at async Object.run (/usr/lib/node_modules/cordova-res/dist/platform.js:24:28)
at async AsyncFunction.CordovaRes [as run] (/usr/lib/node_modules/cordova-res/dist/index.js:35:36)
at async AsyncFunction.runCommandLine (/usr/lib/node_modules/cordova-res/dist/index.js:93:28) {
errors: [],
code: 'BAD_SOURCES'
}
2022-10-12T12:23:33.608Z cordova-res:platform Building icon resources for android platform
2022-10-12T12:23:33.609Z cordova-res:image Source image for icon: {
format: 'png',
size: 75122,
width: 1024,
height: 1024,
space: 'srgb',
channels: 4,
depth: 'uchar',
density: 96,
isProgressive: false,
hasProfile: false,
hasAlpha: true
}
2022-10-12T12:23:33.609Z cordova-res:platform Using '/resources/iconTemplate.png' for icon source image for android
2022-10-12T12:23:33.609Z cordova-res:image Generating 'resources/android/icon/drawable-ldpi-icon.png' (36x36) fit='contain' position='center'
2022-10-12T12:23:33.610Z cordova-res:image Generating 'resources/android/icon/drawable-hdpi-icon.png' (72x72) fit='contain' position='center'
2022-10-12T12:23:33.610Z cordova-res:image Generating 'resources/android/icon/drawable-xhdpi-icon.png' (96x96) fit='contain' position='center'
2022-10-12T12:23:33.611Z cordova-res:image Generating 'resources/android/icon/drawable-xxxhdpi-icon.png' (192x192) fit='contain' position='center'
2022-10-12T12:23:33.611Z cordova-res:image Generating 'resources/android/icon/drawable-xxhdpi-icon.png' (144x144) fit='contain' position='center'
2022-10-12T12:23:33.611Z cordova-res:image Generating 'resources/android/icon/drawable-mdpi-icon.png' (48x48) fit='contain' position='center'
2022-10-12T12:23:33.667Z cordova-res:platform Building splash resources for android platform
2022-10-12T12:23:33.668Z cordova-res:image Source image for splash: {
format: 'png',
size: 241630,
width: 2732,
height: 2732,
space: 'srgb',
channels: 4,
depth: 'uchar',
density: 96,
isProgressive: false,
hasProfile: false,
hasAlpha: true
}
2022-10-12T12:23:33.668Z cordova-res:platform Using '/resources/splashTemplate.png' for splash source image for android
2022-10-12T12:23:33.669Z cordova-res:image Generating 'resources/android/splash/drawable-land-ldpi-screen.png' (320x240) fit='contain' position='center'
2022-10-12T12:23:33.671Z cordova-res:image Generating 'resources/android/splash/drawable-land-mdpi-screen.png' (480x320) fit='contain' position='center'
2022-10-12T12:23:33.672Z cordova-res:image Generating 'resources/android/splash/drawable-land-xhdpi-screen.png' (1280x720) fit='contain' position='center'
2022-10-12T12:23:33.672Z cordova-res:image Generating 'resources/android/splash/drawable-land-hdpi-screen.png' (800x480) fit='contain' position='center'
2022-10-12T12:23:33.672Z cordova-res:image Generating 'resources/android/splash/drawable-land-xxhdpi-screen.png' (1600x960) fit='contain' position='center'
2022-10-12T12:23:33.673Z cordova-res:image Generating 'resources/android/splash/drawable-land-xxxhdpi-screen.png' (1920x1280) fit='contain' position='center'
2022-10-12T12:23:33.673Z cordova-res:image Generating 'resources/android/splash/drawable-port-ldpi-screen.png' (240x320) fit='contain' position='center'
2022-10-12T12:23:33.673Z cordova-res:image Generating 'resources/android/splash/drawable-port-mdpi-screen.png' (320x480) fit='contain' position='center'
2022-10-12T12:23:33.674Z cordova-res:image Generating 'resources/android/splash/drawable-port-hdpi-screen.png' (480x800) fit='contain' position='center'
2022-10-12T12:23:33.674Z cordova-res:image Generating 'resources/android/splash/drawable-port-xhdpi-screen.png' (720x1280) fit='contain' position='center'
2022-10-12T12:23:33.675Z cordova-res:image Generating 'resources/android/splash/drawable-port-xxhdpi-screen.png' (960x1600) fit='contain' position='center'
2022-10-12T12:23:33.676Z cordova-res:image Generating 'resources/android/splash/drawable-port-xxxhdpi-screen.png' (1280x1920) fit='contain' position='center'
Generated 18 resources for Android
2022-10-12T12:23:34.768Z cordova-res:cordova:config Orientation preference: undefined
2022-10-12T12:23:34.769Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='ldpi']" ])
2022-10-12T12:23:34.769Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='mdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='hdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='xhdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='xxhdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'icon' node (not found by xpaths: [ "icon[@src][@density='xxxhdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-ldpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-mdpi']" ])
2022-10-12T12:23:34.770Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-hdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-xhdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-xxhdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='land-xxxhdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-ldpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-mdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-hdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-xhdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-xxhdpi']" ])
2022-10-12T12:23:34.771Z cordova-res:cordova:config Creating 'splash' node (not found by xpaths: [ "splash[@density='port-xxxhdpi']" ])
Wrote to config.xml