How to add crosswalk webview in my own android library module?

匿名 (未验证) 提交于 2019-12-03 07:50:05

问题:

I am in the development of an Android library module which has to include Crosswalk Webview. I create the library using Github Sonatype (https://github.com/sonatype/). It works fine without Crosswalk Webview. I tried the following 3 methods to include Crosswalk.

Method 1:

  • Add Crosswalk Webview library in my library project app gradle

  • Error : (Compile error)

  • Failed to resolve: org.xwalk:xwalk_core_library:18.48.477.13

Method 2:

Method 3:

Note: I tried both jar (ordinary, share mode) files

回答1:

I create a new app from the webview to XWalkView to render the three.js stl loader demo, which is not support by the webview no matter WebGlRenderer or CanvasRenderer. Here is the process how to use the crosswalk module:

Step 1:File->New->Import Module

step 2 select the module and rename if you need

step 3 choose all the option

here android studio may ask you to update, update it

step 4 process the module dependency

After this ,the Gradle Build Running automatically Here We have finished the crosswalk inport.

step 5 use the XWalkView

add this priviledges to AndroidManifest.xml

add hardware acceleration on to application node of AndroidManifest.xml

android:hardwareAccelerated="true" 

add this to layout file

add this to activity

XWalkView mXWalkView = (XWalkView) findViewById(R.id.xWalkView); mXWalkView.load("http://192.168.1.42/test", null); 

Here we finished this is the result I use webview and XWalkView to render three.js STL loader.

webview not support

XWalkView supports well

Haha it works.


Follow is the another old implementation , and you can also refer to this good [post] or doc11.

here is the source code.

Download proper Crosswalk Android webview package and unpackage it from https://crosswalk-project.org/documentation/downloads.html

Copy xwalk_core_library_java.jar from crosswalk libs to app/libs/ in the android studio project, and write click on the file, select the "Adds As Library"

Copy other contents under crosswalk libs to app/src/main/jniLibs/

Make an Android Resource dir res2, and copy files in crosswalk res dir to this dir.

Add this to AndroidMenifest.xml

   and add android:hardwareAccelerated="true" to application node.to use hardware acceleration which is needed by crosswalk webview 

add this to layout

add this to Activity

XWalkView mXWalkView = (XWalkView) findViewById(R.id.webview);     mXWalkView.load("http://xxxxxx.com", null); 

if you want to debug romote add this.

XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!