7
votes

when i serve ionic app, its working in browser but the build apk for android not working. the apk is not installable.

i tried ionic cordova build android --release

the build pass with following message

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\ruban\AppData\Local\Android\Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preReleaseBuild UP-TO-DATE
> Task :CordovaLib:checkReleaseManifest UP-TO-DATE
> Task :CordovaLib:processReleaseManifest UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE`
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]
D:\myApp\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]

The build creates unsigned apk file which doesnot install on my android device.

Ionic info command shows follwing messages Ionic:

   ionic (Ionic CLI)             : 4.12.0 (C:\Users\ruban\AppData\Roaming\nvm\v10.15.3\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.1.2
   @angular-devkit/build-angular : 0.13.7
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.7
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   cordova (Cordova CLI) : 9.0.0
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 4 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\ruban\AppData\Local\Android\Sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10
4
have you tried without --release flagKhurshid Ansari
without --release it didnot throw any error, but the apk is still not installableuser3209130
whenever i try to install it, it shows "app not installed"user3209130
could you tell me what is the argument --release foruser3209130
IT worked build without --release worked, but could you tell me importance of --releaseuser3209130

4 Answers

4
votes

You don't need to fix anything couse it isn't an error. but if you want to fix it...

if you don't like this alert, you should add the next lines to the config.xml file

<splash density="ldpi" src="resources/android/splash/drawable-ldpi-screen.png" />
<splash density="mdpi" src="resources/android/splash/drawable-mdpi-screen.png" />
<splash density="hdpi" src="resources/android/splash/drawable-hdpi-screen.png" />
<splash density="xhdpi" src="resources/android/splash/drawable-xhdpi-screen.png" />
<splash density="xxhdpi" src="resources/android/splash/drawable-xxhdpi-screen.png" />
<splash density="xxxhdpi" src="resources/android/splash/drawable-xxxhdpi-screen.png" />

the resources can be drawable-xxxhdpi-screen ... or u can use port or land.

with the next line you should be able to generate the key to sign it

keytool -genkey -v -keystore ejemplo.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

and with the next line you will be able to sign your app

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ejemplo.keystore app-release-unsigned.apk alias_name

With this you sign the apk and you will be able to install the app in Android.

This worked for me.

1
votes

I think you didn't generate the resources yet. Try out the following:

ionic cordova resources
0
votes

You need to put ANDROID_HOMEto your PATH

set ANDROID_HOME=C:\Users\adt-bundle-windows-x86-20140321\sdk\tools

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

0
votes

Simple run application in android :

1) Connect device and make sure enable usb debugging (in setting - developer options)

2) In cmd type : adb devices

3) Now run : ionic cordova run android

(Ionic cli will do everything and install in your device.)