I have created sample Wokrlight Project with Dojo library (default template project).
The Android version of app runs fine in the Android Emulator showing the content of index.html. But When I run the same app in a device, it first shows IBM splash image and then the following error:
Application Error The Connection to the server was unsuccessful. (file:///data/data/com.HelloWorklight/files/www/default/index.html)
Here are the steps I followed.
- Create New Hybrid Application Worklight Project "HelloWorklight" with Application Name as "HelloWorklight".
- Added Dojo Library using "Configure Javascript Library" and click on "finish" == This created a Project Named "HelloWorklight" in Eclipse.
- Now I added Android phones and tablets in "application-descriptor.xml" (Using Design Tab Only) == Now I can See "android" SubFolder inside "Apps\HelloWorklight\"
- Then I right-clicked on "android" ( from Apps\HelloWorklight ) and Then selected "Run As" > "Android Studio Project" == This created One more project (Android Project) in eclipse as "HelloWorklightHelloWorklightAndroid"
- Now I right-click on "HelloWorklightHelloWorklightAndroid" and select "Run As" > "Android Application" == This opens AVD / Android Emulator with default Device and I can see the index.html content on the Android Emulator screen.
- Now When My Test Android Device is connected to system, "Run As .." option promts me to select Emulator / Device. When I select Device It installs the app on Device and runs Application. == Here I see first IBM Splash Screen the the above error.
NOTE
- I tried running application using .apk exported. which turns out to be showing same error message. When I check the .apk file it has all contents required (html, js and css files). Even the location of file is file:///data/data/com.HelloWorklight/files/www/default/index.html
- The application runs on Emulator Even if Worklight Development Server is stopped