AppCan project into Android Studio

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/u011033906/article/details/90233679

Only specific analysis of the latest version of AppCan, important or specific issues

I have a few key points to solve the problem

  • Look decompile package
  • See Android running up the log, log analysis
  • See source code appcan-android to see appcan js source code
  • Narrow the scope of the problem

1. decompile AppCan official to give you a bag

  • Access to resources file after decompiling

Here Insert Picture Description

  • assets in the catalog:
    Here Insert Picture Description
  1. error and widget catalog and info.xml AppCan this folder is generated for you, these resources intact copy to you AS project. Empty widget folder (Make sure widget files in a folder no distortion)

  2. Remember lib folder under the .so files, which are to be put in your Android Studio projects, eg:

Here Insert Picture Description
3. Import plug-in you use on AppCan, need to build gradle jar package or by importing:

Here Insert Picture Description
Here Insert Picture Description

PS: When adding .jar package folder there AndroidManifest.xmland plugin.xml, AndroidManifest.xmlin the code is added to the project AndroidManifest.xmlfile. plugin.xmlAdd to res/xml/plugin.xml, the file does not exist create it. Missing jar package to find ways to download,

Here Insert Picture Description

2. copy the code to the next AS assets \ widget directory

Here Insert Picture Description

3. Several pit

//设置侧滑
    appcan.window.setSlidingWindow({
        rightSliding : {
            width : 240,
            url : "uexWindow_right.html"
        },
        animationId : '1', //仿QQ侧滑
        bg : '' //仿QQ侧滑;注:res目录为js文件夹同级目录wgtRes
    });

When running this code will crash, error Resources not found, because AppCan packed their own time to add some resource files to our .apk file, and then reference the runtime. Our new AS there are no resources to this file, so an error

(function($) {

    alert("ready  end!");

    appcan.ready(function(){
        alert("ready  ready!");
    }
    window.uexOnload = function(){
                    alert("ready  ready!");
        }
})($);

among them

    appcan.ready(function(){
        alert("ready  ready!");
    }

Do not run, the reason is not clear, but the code is replaced

    window.uexOnload = function(){
                    alert("ready  ready!");
        }

On it

Reference links

Guess you like

Origin blog.csdn.net/u011033906/article/details/90233679