问题
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')
}
回答1:
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.
回答2:
I tried integrating crosswalk lite with cordova android project. When I generated the APK file, it ran perfectly. With normal crosswalk my app size was 26MB, with crosswalk lite its now 14MB.
I downloaded crosswalk-lite-cordova-10.39.232.1-arm.zip and extracted it in a folder. Then I had to download cordova lite webview to link cordova with xwalk webview.
Once both downloaded:
cd /path/to/crosswalk-cordova-android/framework
ln -s /path/to/crosswalk-webview-unzipped-folder/
Then create a cordova project by executing this command:
./bin/create project_crosswalk
To build:
./cordova/build
I hope this helps you.
xwalk_core_library
来源:https://stackoverflow.com/questions/31031714/android-crosswalk-lite-android-studio-integration