Closed BorntraegerMarc closed 3 years ago
It only happens with a production "release" build.
I've seen this too, but even though it says "Error" in the message, it seems more like a warning in that it seems to produce a working build. @BorntraegerMarc can you confirm that this is not causing your build to fail?
@dpogue I can confirm that the build succeeds but the sub task > Task :app:lintVitalRelease
seems to fail (but it doesn't cause the full build to fail). Not sure how to explain. Here's my output:
Hello all !
This error also appears when I do release build after upgrading to cordva-android@8.0.0.
I noticed that the error/warning disappear when I do the following modifications in my config.xml file:
Before (the following rises 4 errors/warning):
<platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true">
</application>
</edit-config>
<preference name="loadUrlTimeoutValue" value="700000" />
<icon background="res/icons/android/ldpi-background.png" density="ldpi" foreground="res/icons/android/ldpi-foreground.png" src="res/icons/android/drawable-ldpi-icon.png" />
<icon background="res/icons/android/mdpi-background.png" density="mdpi" foreground="res/icons/android/mdpi-foreground.png" src="res/icons/android/drawable-mdpi-icon.png" />
<icon background="res/icons/android/hdpi-background.png" density="hdpi" foreground="res/icons/android/hdpi-foreground.png" src="res/icons/android/drawable-hdpi-icon.png" />
<icon background="res/icons/android/xhdpi-background.png" density="xhdpi" foreground="res/icons/android/xhdpi-foreground.png" src="res/icons/android/drawable-xhdpi-icon.png" />
<icon background="res/icons/android/xxhdpi-background.png" density="xxhdpi" foreground="res/icons/android/xxhdpi-foreground.png" src="res/icons/android/drawable-xxhdpi-icon.png" />
<icon background="res/icons/android/xxxhdpi-background.png" density="xxxhdpi" foreground="res/icons/android/xxxhdpi-foreground.png" src="res/icons/android/drawable-xxxhdpi-icon.png" />
<splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
<splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
<splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
<splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
</platform>
After (the following rises no error/warning):
<platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true">
</application>
</edit-config>
<preference name="loadUrlTimeoutValue" value="700000" />
<icon background="res/icons/android/ldpi-background.png" density="ldpi" foreground="res/icons/android/ldpi-foreground.png" src="res/icons/android/drawable-ldpi-icon.png" />
<icon background="res/icons/android/mdpi-background.png" density="mdpi" foreground="res/icons/android/mdpi-foreground.png" src="res/icons/android/drawable-mdpi-icon.png" />
<icon background="res/icons/android/hdpi-background.png" density="hdpi" foreground="res/icons/android/hdpi-foreground.png" src="res/icons/android/drawable-hdpi-icon.png" />
<icon background="res/icons/android/xhdpi-background.png" density="xhdpi" foreground="res/icons/android/xhdpi-foreground.png" src="res/icons/android/drawable-xhdpi-icon.png" />
<icon background="res/icons/android/xxhdpi-background.png" density="xxhdpi" foreground="res/icons/android/xxhdpi-foreground.png" src="res/icons/android/drawable-xxhdpi-icon.png" />
<icon background="res/icons/android/xxxhdpi-background.png" density="xxxhdpi" foreground="res/icons/android/xxxhdpi-foreground.png" src="res/icons/android/drawable-xxxhdpi-icon.png" />
<splash density="hdpi" src="res/screen/android/splash-port-hdpi.png" />
<splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
<splash density="ldpi" src="res/screen/android/splash-port-ldpi.png" />
<splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
<splash density="mdpi" src="res/screen/android/splash-port-mdpi.png" />
<splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
<splash density="xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
<splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
</platform>
Do you think that adding the "default" densities is correct to solve this problem (hdpi, ldpi, mdpi and xhdpi in my case) or is the error caused by something else ? In fact I do not really know if I am really solving the problem or just workarounding it...
apiaget
I can confirm that suggestion by @apiaget makes error/ warnings go away.
I have renamed resources with density="port-*"
to density="*"
since there is only portrait mode in the my app
True. Adding additionally the density without port
or land
does get rid of the error. Wondering what other orientations as "default" there is except from portrait and landscape
OK so apparently there are a few more: https://developer.android.com/guide/topics/manifest/activity-element.html#screen
Here is a gist diff of @apiaget's before and after.
@marckassay thanks a lot. Could you elaborate how the splash screen should look different from "default" mode to portrait mode?
And what exactly this https://gist.github.com/marckassay/913c06fac2a64a25ae9115435f8195d3/revisions?diff=unified#diff-1c17390bf45f1534c828cbeea42bb0deR7 "background / foreground" is
@BorntraegerMarc my intention of that gist diff was just to highlight what @apiaget modified, to have the error disappear, which is seen in this illustration:
The "background / foreground" that you're referring to applies to app icons. I don't think that's relevant to the issue you reported.
Fyi, an alternative to using 'cordova-plugin-splashscreen' can be cordova-plugin-lottie-splashscreen which may be an interest to you. If you're unfamiliar with this plugin, it uses Lottie.
Lottie is a library for Android, iOS, Web, and Windows that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile and on the web!
I attempted to implemented this as a replacement to 'cordova-plugin-splashscreen' but was unable to find any available animations fitting to my needs. Manually modifying the json is difficult since it's hardly readable and installing Adobe After Effects wasn't something I was going to do.
foreground/ background attributes may be related to new Google Play app icon specifications - am I right, @marckassay ?
Android Developers blog: Introducing a new Google Play app and game icon specification Android Developers > Docs > Adaptive icons
@piotr-cz you may be right. It seems those attributes are, as you have listed, for adaptive icons for Android devices too, where the icons can be in a various shapes. Such as these:
And config.xml supports fallback for devices that don't have this feature.
... src attribute must be defined when then foreground attribute is defined with a vector or color ...
Where the value of src
, in this example, is a png file.
It will nice to see the day when we just provide a background and foreground vector values.
package.json:
cordova plugin add cordova-plugin-splashscreen
npm install
config.xml add:
...
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
...
I've solved creating a new directory and copying the icon as described here: https://github.com/oliviercherrier/mauron85-background-geolocation-example-ionic2
The adjustment to config.xml made by apiaget fixed it for me.Thank you for the input everyone.
HI , i got this.
this is my ionic info..
@dpogue I can confirm that the build succeeds but the sub task
> Task :app:lintVitalRelease
seems to fail (but it doesn't cause the full build to fail). Not sure how to explain. Here's my output:
Any solution found?
Does this error occur if you run ionic cordova resources
with the cordova-res
library installed and then rebuild (might need to clear your platform and rebuild Android entirely)? This should be the new default as of Ionic CLI 5.X (install the latest Ionic CLI & cordova-res
just to be safe) - I've never seen this error myself...
@KasunGamage - your AAPT error isn't the same one from above. Try this Github issue: https://github.com/arnesson/cordova-plugin-firebase/issues/1081
I have the same problem I have not found anything yet, could you solve it?
what does this dO?
HI , i got this.
this is my ionic info..
reduce the file size.
To solve this error I create a diretory 'drawable' na pasta 'platforms\android\app\src\main\res' After that I copied the file screen.png and ic_launcher.png to the folder 'drawable. Obs. the *.png files were the files used to with the comand 'ionic cordova resorses'. I just remane them with the especified name screen and ic_launcher.
To solve these errors, go to:
platforms\android\app
and in your build.gradle file add this line "checkReleaseBuilds false;" inside lintOptions block like this:
lintOptions {
checkReleaseBuilds false;
}
Hope it helps.
@apiaget's answer is correct. You should provide default resources. From Android documentation (I recommend you read through the page)
Likewise, if you provide different layout resources based on the screen orientation, you should pick one orientation as your default. For example, instead of providing layout resources in layout-land/ for landscape and layout-port/ for portrait, leave one as the default, such as layout/ for landscape and layout-port/ for portrait.
I also wrote more explanation and made a pull request to fix the docs.
apache/cordova-plugin-splashscreen#228
@apiaget I've added:
<platform name="android">
<preference name="SplashMaintainAspectRatio" value="true" />
<icon density="ldpi" height="36" src="res/icon/android/icon-36-ldpi.png" width="36" />
<icon density="mdpi" height="48" src="res/icon/android/icon-48-mdpi.png" width="48" />
<icon density="hdpi" height="72" src="res/icon/android/icon-72-hdpi.png" width="72" />
<icon density="xhdpi" height="96" src="res/icon/android/icon-96-xhdpi.png" width="96" />
<splash density="hdpi" src="res/screen/android/splash-port-hdpi.png" />
<splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
<splash density="ldpi" src="res/screen/android/splash-port-ldpi.png" />
<splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
<splash density="mdpi" src="res/screen/android/splash-port-mdpi.png" />
<splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
<splash src="res/splash/android/Default@2x~universal~anyany.png" />
<allow-intent href="market:*" />
<custom-config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
</custom-config-file>
</platform>
with little luck, this doesn't seem to work
Why my image paths is different from @apiaget ??
Ex.:
`
<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" />`
The config.xml updates didn't work for me, unfortunately, However, adding this to my project_root/build-extras.gradle resolved the issue:
allprojects {
configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
config.resolutionStrategy.eachDependency { details ->
details.useVersion("3.5.0-alpha03-5252756")
}
}
}
Then I added a hook like this to copy it to the build folder: https://github.com/QuantiModo/quantimodo-android-chrome-ios-web-app/blob/develop/hooks/build-extras-hook.js
FWIW, this issue still exists in 9.0.0.
Same problem. Resolve by converting my PNG 32 bit color splashcreen image to PNG 24.
Hi all, I tried all of the above solutions but it still didn't work. Is there anyone like me?
I have tried to add this in the config.xml
<splash density="land-ldpi" src="res/screen/android/screen-ldpi-landscape.png" />
<splash density="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
<splash density="land-mdpi" src="res/screen/android/screen-mdpi-landscape.png" />
<splash density="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
<splash density="land-hdpi" src="res/screen/android/screen-hdpi-landscape.png" />
<splash density="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" />
<splash density="land-xhdpi" src="res/screen/android/screen-xhdpi-landscape.png" />
<splash density="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />
<splash density="land-xxhdpi" src="res/screen/android/screen-xxhdpi-landscape.png" />
<splash density="port-xxhdpi" src="res/screen/android/screen-xxhdpi-portrait.png" />
<splash density="land-xxxhdpi" src="res/screen/android/screen-xxxhdpi-landscape.png" />
<splash density="port-xxxhdpi" src="res/screen/android/screen-xxxhdpi-portrait.png" />
And tried to change build.gradle like @mikepsinn .
I would appreciate any suggestions could help me.
In the portrait images, take off the "port-" so they just have the resolution like this: port-ldpi to ldpi
Only do this on the portrait images! Report back.
Sent from my iPad, please excuse typos and autocorrects.
On Nov 26, 2019, at 10:53 PM, evazc notifications@github.com wrote:
Hi all, I tried all of the above solutions but it still didn't work. Is there anyone like me?
I have tried to add this in the config.xml
<splash density="land-ldpi" src="res/screen/android/screen-ldpi-landscape.png" /> <splash density="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" /> <splash density="land-mdpi" src="res/screen/android/screen-mdpi-landscape.png" /> <splash density="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" /> <splash density="land-hdpi" src="res/screen/android/screen-hdpi-landscape.png" /> <splash density="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" /> <splash density="land-xhdpi" src="res/screen/android/screen-xhdpi-landscape.png" /> <splash density="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" /> <splash density="land-xxhdpi" src="res/screen/android/screen-xxhdpi-landscape.png" /> <splash density="port-xxhdpi" src="res/screen/android/screen-xxhdpi-portrait.png" /> <splash density="land-xxxhdpi" src="res/screen/android/screen-xxxhdpi-landscape.png" /> <splash density="port-xxxhdpi" src="res/screen/android/screen-xxxhdpi-portrait.png" />
And tried to change build.gradle like @mikepsinn .
I would appreciate any suggestions could help me.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@ppetree
Taking off the "port-" works for me. Thank you for your help. I was so careless that I missed what @BorntraegerMarc said.
True. Adding additionally the density without
port
orland
does get rid of the error. Wondering what other orientations as "default" there is except from portrait and landscape
Glad I could help... and we all miss stuff so no worries... especially since this is an unnecessary “bug”
Sent from my iPhone, please pardon typos and autocorrect.
On Nov 27, 2019, at 8:42 PM, evazc notifications@github.com wrote:
@ppetree
Take off the "port-" works for me. Thank you for your help. I was so careless that I missed what @BorntraegerMarc said.
True. Adding additionally the density without port or land does get rid of the error. Wondering what other orientations as "default" there is except from portrait and landscape
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I have made the changes as per above solution but still i am getting error Thread : https://github.com/apache/cordova-android/issues/880 config.xml
<platform name="android">
<preference name="loadUrlTimeoutValue" value="700000" />
<allow-intent href="market:*" />
<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" />
<splash density="ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
Error
> Task :app:mergeReleaseResources
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #2: Unexpected error during compile 'D:\indra\client\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png', attempting to stop daemon.
20 actionable tasks: 1 executed, 19 up-to-date
This should not happen under normal circumstances, please file an issue if it does.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
D:\indra\client\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #2: Unexpected error during compile 'D:\indra\client\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png', attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
If you google this: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #2 You'll see this is happening to others and it looks like the solution is to upgrade/patch your android build system.
Yes i had to update android studio along with gradle 3.5 and distributionUrl to 5.4.1-all. This is all happening due to splashscreen file size if you are having splash.png less than 100kb then it works great even with current gradle 3.3.0 otherwise it will give above error.
In the portrait images, take off the "port-" so they just have the resolution like this: port-ldpi to ldpi Only do this on the portrait images! Report back. Sent from my iPad, please excuse typos and autocorrects.
Thanks ppetree, this fixed it for me as well.
In addition to removing "port-" from the portrait splashes, I had another app with large 32-bit png splashes that generated the same error, had to drop them all to 8-bit, so there is some size issue as well for the --release build as noted above.
To solve these errors, go to:
platforms\android\app
and in your build.gradle file add this line "checkReleaseBuilds false;" inside lintOptions block like this:
lintOptions { checkReleaseBuilds false; }
Hope it helps.
This seems to have worked for me 🤔
All that does is hide the error messages, it doesn't actually "solve" the problem.
All that does is hide the error messages, it doesn't actually "solve" the problem.
Oh. So which is the right solution?
Changing the config entry seems to solve the problem. The images display properly and the warnings and errors go away. This is the workaround until either cordova is fixed OR the docs are fixed.
The config.xml updates didn't work for me, unfortunately, However, adding this to my project_root/build-extras.gradle resolved the issue:
allprojects { configurations.matching { it.name == '_internal_aapt2_binary' }.all { config -> config.resolutionStrategy.eachDependency { details -> details.useVersion("3.5.0-alpha03-5252756") } } }
Then I added a hook like this to copy it to the build folder: https://github.com/QuantiModo/quantimodo-android-chrome-ios-web-app/blob/develop/hooks/build-extras-hook.js
This works for me, thanks
Solution from @apiaget worked, I don't understand though why should I have the tag <splash
in my config.xml
since I don't have the plugin cordova-plugin-splashscreen
installed
The resources (icon, splash) should be added automatically to the config.xml when adding the android platform. That worked some time ago, right? Maybe it does not work since the platform is stored in package.json? Anyway, the config.xml should contain the platform tag with all the required settings incl. icons and splashes. Automatically.
@infacto As you can see on the respective documentation here, that is just applicable when you have the plugin installed.
And the icons can be set by following this docs. I just expected that this configuration is added automatically on adding the Android platform and / or plugin installation. (The standard icons). But ok, you have to add this manually. I think my memories of automatically set resources are from Ionic. I thought it was Cordova. Sorry. (Not sure. But anyway... an predefined config is not the worst idea. e.g. changing the Icons is an essential configuration.)
Confirmed: Adding the density without "land-" or "port-" fixes the issue. But what's the correct sizes? Is the default density (without prefix) for portait (port)? So I can use the same images or better, remove the density with prefix "port-"?
<splash density="ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
<splash density="mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
<splash density="hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
<splash density="xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
<splash density="xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
<splash density="xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.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"/>
<!-- This can be removed: -->
<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"/>
Is this correct? Currently I have all three kinds.
UPDATE 1: In the error log, there are 12 errors for missing "port-" and "land-". But if I add the density without prefix, the errors are gone. What does this mean? Because I use the port-size for it. I expect squared images. Idk. In this case, only declare the density without prefix. What is the MissingDefaultResource resolution? 🤔
UPDATE 2: Ok, I found a related issue in Ionic repo. https://github.com/ionic-team/cordova-res/issues/46 This guy uses the land-one. But I'm not sure if the app supports both orientations. But anyway, I use the landscape now for default. But I don't like the missing knowledge.
For the sake of completeness. This was my initial error without the default density:
> Task :app:lintVitalRelease
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-hdpi\screen.png: Error: The drawable "screen" in drawable-land-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-ldpi\screen.png: Error: The drawable "screen" in drawable-land-ldpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-mdpi\screen.png: Error: The drawable "screen" in drawable-land-mdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-xhdpi\screen.png: Error: The drawable "screen" in drawable-land-xhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-xxhdpi\screen.png: Error: The drawable "screen" in drawable-land-xxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png: Error: The drawable "screen" in drawable-land-xxxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-hdpi\screen.png: Error: The drawable "screen" in drawable-port-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-ldpi\screen.png: Error: The drawable "screen" in drawable-port-ldpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-mdpi\screen.png: Error: The drawable "screen" in drawable-port-mdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-xhdpi\screen.png: Error: The drawable "screen" in drawable-port-xhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-xxhdpi\screen.png: Error: The drawable "screen" in drawable-port-xxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
C:\projects\test-app\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png: Error: The drawable "screen" in drawable-port-xxxhdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead to crashes when the drawable is queried in a configuration that does not match this qualifier [MissingDefaultResource]
Explanation for issues of type "MissingDefaultResource":
If a resource is only defined in folders with qualifiers like -land or -en,
and there is no default declaration in the base folder (layout or values
etc), then the app will crash if that resource is accessed on a device
where the device is in a configuration missing the given qualifier.
As a special case, drawables do not have to be specified in the base
folder; if there is a match in a density folder (such as drawable-mdpi)
that image will be used and scaled. Note however that if you only specify
a drawable in a folder like drawable-en-hdpi, the app will crash in
non-English locales.
There may be scenarios where you have a resource, such as a -fr drawable,
which is only referenced from some other resource with the same qualifiers
(such as a -fr style), which itself has safe fallbacks. However, this still
makes it possible for somebody to accidentally reference the drawable and
crash, so it is safer to create a default dummy fallback in the base
folder. Alternatively, you can suppress the issue by adding
tools:ignore="MissingDefaultResource" on the element.
(This scenario frequently happens with string translations, where you might
delete code and the corresponding resources, but forget to delete a
translation. There is a dedicated issue id for that scenario, with the id
ExtraTranslation.)
12 errors, 0 warnings
I would be very grateful for any clarification. 🙏
ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter
Adding these plugins removed any build error for me.
the same problem,cordova-android 8.1.0
`* What went wrong: Execution failed for task ':app:mergeReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #6: Unexpected error during compile 'E:\Git\blinker-app\platforms\android\app\src\main\res\drawable-land-xxhdpi\screen.png', attempting to stop daemon. This should not happen under normal circumstances, please file an issue if it does.`
Bug Report
Problem
What is expected to happen?
Building a cordova app with
ionic cordova build android --prod --release
does not throw errors.What does actually happen?
I see this error in the console:
Information
This error was not present in v7.X
I do specify a splash screen in
config.xml
like so:<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
And it gets displayed correctly (according to my tests so far)
I'm using this plugin to configure the splash screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
I only included 1 example of the errors I'm getting to keep the bug report small. But I get it for different screen sizes & densities.
I understand that it has something to do with android linting rules: http://tools.android.com/tips/lint-checks
But I don't fully understand if it's a misconfiguration in the plugin or if cordova-android needs to do something differently.
Command or Code
ionic cordova build android --prod --release
Environment, Platform, Device
On all. It happens on build time.
Version information
Checklist