Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors about drawable since upgrading to cordova-android 8.0.0 #185

Closed
3 tasks done
BorntraegerMarc opened this issue Mar 13, 2019 · 3 comments · Fixed by #337
Closed
3 tasks done

Build errors about drawable since upgrading to cordova-android 8.0.0 #185

BorntraegerMarc opened this issue Mar 13, 2019 · 3 comments · Fixed by #337

Comments

@BorntraegerMarc
Copy link

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:

/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]

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.

PS: I also posted a bug here apache/cordova-android#689 because I'm not sure where the problem is (if in the plugin or cordova-android).

Command or Code

ionic cordova build android --prod --release

Environment, Platform, Device

On all. It happens on build time.

Version information

~/Documents/komed/komed-frontend$ ionic info

Ionic:

   ionic (Ionic CLI)  : 4.11.0 (/Users/borntsch/.nvm/versions/node/v8.13.0/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 8.0.0, browser 5.0.4, ios 5.0.0
   Cordova Plugins       : cordova-plugin-ionic-webview 2.3.1, (and 27 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/borntsch/Library/Android/sdk)
   ios-deploy        : 1.9.2
   ios-sim           : 7.0.0
   NodeJS            : v8.13.0 (/Users/borntsch/.nvm/versions/node/v8.13.0/bin/node)
   npm               : 6.4.1
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@BorntraegerMarc
Copy link
Author

It only happens with a production "release" build.

@janpio
Copy link
Member

janpio commented May 5, 2019

@BorntraegerMarc Can you please post the complete output of one of these builds? Best with a new Cordova app that you just created to reproduce this error, then it will be even simpler for us to understand. Bonus points if it is a plain Cordova app, not using Ionic (because that removes another variable). Thanks.

@janpio
Copy link
Member

janpio commented May 5, 2019

(There is more discussion in the related general cordova-android issue: apache/cordova-android#689)

distante added a commit to distante/cordova-plugin-splashscreen that referenced this issue Aug 14, 2020
(Note this is an almos 1 to 1 copy of apache#228 by @toshihidetagami

### Platforms affected
Only docs
 
### Motivation and Context
Current documentation lacks the default resources for Android.
On Android, you can provide alternative resources for specific device configuration, like current docs provide alternative resources for portrait and landscape orientation. But error will be thrown if a device configuration does not match any specific alternative resources, so you should provide a default (In this case, without port- or land- ) as a fallback.
This change fixes the error reported in apache#185 and [apache/cordova-android#689](apache/cordova-android#689).
 
### Description
[Although orientation is only portrait and landscape as of now](https://developer.android.com/guide/topics/resources/providing-resources#OrientationQualifier), providing default would prevent [MissingDefaultResource lint check error](http://tools.android.com/tips/lint-checks) and considered as [good practice for Android resources configuration](https://developer.android.com/guide/topics/resources/providing-resources#Compatibility).
 
> 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.
 
Note:
You don’t have to provide a default for screen density. [The system use whichever resources are the best match](https://developer.android.com/guide/topics/resources/providing-resources#DensityQualifier).

### Testing
### Checklist
* [ ]  I've run the tests to see all new and existing tests pass
* [ ]  I added automated test coverage as appropriate for this change
* [ ]  Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
* [x]  If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
* [x]  I've updated the documentation if necessary
@erisu erisu closed this as completed in #337 Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants