Translate

Sencha native build - App doesn't go beyond app loading screen after installing in phone

I has developed a sencha touch application and I wanted to do a native build using Sencha cmd. I went through a really bad time trying to find out what exactly to do.

First, there is a difference in below two builds.

1. Sencha app build native
2. Sencha app package build

The first one creates the actual application using sencha native packager. The second  creates the source to be put into a packager(eg: Cordova). Say you are going to build for android. Either way you will get an apk which can be installed in an android phone. But if you are planning to access native APIs then either you should do the native build or you should do the package build plus another wrapper.

I first packaged my app using "sencha app package build". But later I wanted to access native APIs(for example accessing the network status of the device).Therefore I ran sencha app build native command. I got a nice apk and I installed it in my phone.

Problems I faced and how I solved them

1. The app got stuck on app loading screen and none of the pictures I had on app loading screen were visible.

There is a file called app.json inside the application folder. You need to put paths to all the JS, CSS assests and resources inside this file.


2. Even after solving above problem app was still stuck at app loading screen.

I ran "Sencha app build production" command. This creates a minimized version of the app inside
./build/production folder. I pointed localhost to this. Then when app loads I could see the errors on console. The problem had been that I had included my "sencha-touch-all.js" file inside my index.html.(<script type="text/javascript" src="touch/sencha-touch-all.js"></script>)
Actually there is no need to put this inside index.html because we have already included this inside app.json as a JS assest. In the native build this file is not inside the app anymore but index file requires this because I have put it there. Once I removed this from index.html and did the native build again, my app didn't stuck at app loading screen anymore.

2 comments:

  1. what version of android is your emulator/phone?

    ReplyDelete
  2. Hello,
    The informative article on Sencha native build an App doesn't go beyond app loading screen after installing in phone is nice to know about about it.Moreover Cross Platform App Development is more better thanks for sharing the information about it. Xamarin Consulting

    ReplyDelete