Js error when packaging android app with egret, egretandroid

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.