简体   繁体   English

Android Crosswalk Lite-Android Studio集成

[英]Android Crosswalk Lite - Android Studio integration

I have successfully implemented crosswalk webview project inside an Android studio project. 我已经在Android Studio项目中成功实现了人行横道Webview项目。 Basically by following this link: https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/ 基本上通过以下链接进行链接: 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. 熟悉实施人行横道的人们知道,应用程序的大小会增加+-20-30 mb。 For this reason i have been trying to integrate the lite version of crosswalk. 因此,我一直在尝试集成人行横道的精简版。 Which is +- 10 mb, Unfortunaly without success. 这是+-10 mb,很遗憾没有成功。

the normal crosswalk project has a maven version available at https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/ 正常的人行横道项目具有Maven版本,可通过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. lite版本在https://download.01.org/crosswalk/releases/crosswalk-lite/android/canary/上也有AAR版本,但没有POM文件,我无法在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. 我创建了一个库项目,复制了所有相关文件,创建了gradle文件,并将其包含在一个小型测试应用程序中。 and so far everything seems to be alright. 到目前为止,一切似乎都还不错。 App compiles. 应用程序编译。 all classes like XWalkView are available inside my app. XWalkView之类的所有类都可以在我的应用程序中找到。 Running the app works as well, except that the webview is completely black. 运行该应用程序也可以正常运行,只是Webview完全是黑色的。

Now i think it got something to do with the libxwalkcore.so file which does not gets loaded somehow. 现在我认为它与libxwalkcore.so文件有关,该文件没有以某种方式加载。 Placed in every imaginable folder (jars, jniLibs, lib etc). 放置在每个可以想象的文件夹(jar,jniLibs,lib等)中。 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. 问题我是否有人已经成功使lite版本在android studio项目中工作。

btw. 顺便说一句 the gradle file of the crosswalk-lite library app contains: crosswalk-lite库应用程序的gradle文件包含:

dependencies {
    compile files('libs/xwalk_core_library_java_library_part.jar')
    compile files('libs/xwalk_core_library_java_app_part.jar')
}

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 像这样更改您的MainActivity.java

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. 在这里 ,了解更多信息。

I tried integrating crosswalk lite with cordova android project. 我尝试将人行横道lite与cordova android项目集成。 When I generated the APK file, it ran perfectly. 当我生成APK文件时,它运行完美。 With normal crosswalk my app size was 26MB, with crosswalk lite its now 14MB. 在正常的人行横道下,我的应用程序大小为26MB,而人行横道lite现在为14MB。

I downloaded crosswalk-lite-cordova-10.39.232.1-arm.zip and extracted it in a folder. 我下载了crosswalk-lite-cordova-10.39.232.1-arm.zip并将其解压缩到一个文件夹中。 Then I had to download cordova lite webview to link cordova with xwalk webview. 然后,我必须下载cordova lite webview才能将cordova与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: 然后通过执行以下命令创建一个cordova项目:

./bin/create project_crosswalk

To build: 建立:

./cordova/build

I hope this helps you. 我希望这可以帮助你。

xwalk_core_library xwalk_core_library

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM