Js error when packaging android app with egret, egretandroid
Create an android app and generate an apk after compilation. The app cannot run after the mobile phone is installed. The following error is displayed:
JS error
Report error assets/egret-game/libs/core/egret/context/devices/nativedevicecontext. js: 203: egret_native.isFileExists is not a function
Click OK in the error prompt box, black screen
When the preceding error occurs, check whether the core version is the same as the android support version and whether the core version is the latest version.
An Error occurred when calling android functions in js: Uncaught Error: Error calling method on NPObject
Put this function in Handler.
It may be a thread security issue.
How to Use PhoneGap to package Android-based webapps
On Android, we can. webkit. webView is used as the main view of the application to generate an application and load the specified webpage when the application starts. In this way, a Android-based WebApp is built. For Android, Sencha's phonegap is also based on this method to package web applications. After downloading phonegap, it mainly includes two files: 1. phonegap.0.9.4.jar. the jar file contains the DroidGap class, it encapsulates the Activity and WebView to facilitate packaging. The more main function is to implement multiple Webkit plugins. Through these plugins, you can directly call some android system functions in javascript, such as getting device information such as the screen size, the system version number and other functions include making calls, sending text messages, and writing local files. 2. phonegap.0.9.4.js the js file is encapsulated at a higher level to facilitate the calling of the added plug-in function in javascript. For example, directly call: navigator. notification. vibrate (0) can directly let the mobile phone vibrate and navigator. notification. beep (2) allows the Mobile Phone Beep to repeat the following simple example (you can also refer to an example self-contained in phonegap): (1) java source code file: Sample. javapackage com. phonegap. sample; import android. app. activity; import android. OS. bundle; import com. phonegap. *; public class Sample extends DroidGap {@ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); s Uper. loadUrl ("file: // android_asset/www/index.html") ;}} (2) webpage code: index.html>