Search code examples
androidangularcordova

Converted an Angular app to android using cordova. The apk starts on the emulator but only a blank white screen appears on the actual device


I am converting an angular app using cordova to an android app. The converted apk file comes up on the emulator. But when I install it on the actual device and run it shows up just a white blank screen. Waited for quite a long time but never came up. I am new to this cordova and android and any help is much appreciated.

Even the sampleHelloWorl app does not come up on the device.

Steps followed.

1) ng new HelloWorld

2) cd HelloWorld

3) make in index.html

4) ng build --prod

5) in the same folder create a cordova project by executing cordova create mobile-app com.example.hello OurFirstApp 5) cd mobile-app and copy all the angular output files to cordova www directory i.e del -r www ; cp -r../dist/HelloWorld/* www

6) cordova platform add android

7) cordova build android

8) cordova emulate android --> application comes up on the emulator

to run this on the device I did below

9) cordova build --release android

10) cd platforms\android\app\build\outputs\apk\release

11) keytool -genkey -v -keystore helloappworld.keystore -alias helloappworldmobileapps -keyalg RSA -keysize 2048 -validity 10000

12) jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore helloappworld.keystore app-release-unsigned.apk helloappworldmobileapps

13) zipalign -v 4 app-release-unsigned.apk app-release-signed.apk

14) I then uploaded app-release-signed.apk to my google drive and tried to install and then open. It gives a white blank screen

angular cli version is 8.3.19 . Cordova version is 9.0.0 and the github repo is github.com/ruksan/AngularHelloWorld.git


Solution

  • did the following change in tsconfig.json and it worked "target": "es5"

    thanks a lot @Nidhin Joseph for helping out on this