Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

maven - Android Crosswalk Lite - Android Studio integration

I have successfully implemented crosswalk webview project inside an Android studio project. Basically by following this link: https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/

People familiar with implementing crosswalk know that the app size gets increased by +- 20-30 mb. For this reason i have been trying to integrate the lite version of crosswalk. Which is +- 10 mb, Unfortunaly without success.

the normal crosswalk project has a maven version available at https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/

the lite version has a also AAR edition at https://download.01.org/crosswalk/releases/crosswalk-lite/android/canary/ but there is no POM file and i cannot use it inside Android Studio.

Now i have been trying to manually download the crosswalk-lite version. I created a library project, copied all the relevant files, created the gradle files and included it inside a small test application. and so far everything seems to be alright. App compiles. all classes like XWalkView are available inside my app. Running the app works as well, except that the webview is completely black.

Now i think it got something to do with the libxwalkcore.so file which does not gets loaded somehow. Placed in every imaginable folder (jars, jniLibs, lib etc). doesnt work. no errors in any log.

Question i have if someone already succeeded in getting the lite version working inside a android studio project.

btw. the gradle file of the crosswalk-lite library app contains:

dependencies {
    compile files('libs/xwalk_core_library_java_library_part.jar')
    compile files('libs/xwalk_core_library_java_app_part.jar')
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same issue, this is how I resolved.

I followed the same tutorial, use this repository and dependency instead.

repositories {
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk-lite/android/maven2/'
    }
}

dependency

compile 'org.xwalk:xwalk_core_library_canary:17.46.460.1'

Change your MainActivity.java like this

public class MainActivity extends XWalkActivity {
    XWalkView mXWalkView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void initXWalkView() {
        mXWalkView = (XWalkView) findViewById(R.id.activity_main);
        mXWalkView.load("file:///android_asset/index-mobile.html", null);
    }

    @Override
    protected void onXWalkReady() {
        initXWalkView();
    }
}

Here, for more info.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...