Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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')
}
like image 343
Gillis Haasnoot Avatar asked Jun 24 '15 16:06

Gillis Haasnoot


1 Answers

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.

like image 72
Saahithyan Vigneswaran Avatar answered Nov 02 '22 17:11

Saahithyan Vigneswaran