13

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

Community
  • 1
  • 1
RDY
  • 613
  • 1
  • 9
  • 25
  • Method #2 should work. I've downloaded the `crosswalk-webview-18.48.477.13-arm` zip file and it contains a full AS module. It contains a jar, some resources, and a bunch of .so native libraries that are CPU-dependent (so if you were to integrate this into your library you would be stuck with only the ARM or x86 binaries, or else you would have to create a version of your lib for each architecture. TL;DR: Dont do this man, import via gradle. – Mister Smith Nov 25 '16 at 10:57
  • In gradle method I can't build my sample project. – RDY Nov 25 '16 at 11:12
  • I just realized there is no gradle tutorial anymore in the official page. Apparently its now much more complex to add XWalk and its done using an npm tool. – Mister Smith Nov 25 '16 at 11:31
  • I just found [this](https://crosswalk-project.org/documentation/android/embedding_crosswalk.html) – Mister Smith Nov 25 '16 at 11:32
  • Above link work was working in ordinary android application but library its now work – RDY Nov 25 '16 at 11:34
  • app gradle I added compile 'org.xwalk:xwalk_core_library:18.48.477.13' above sample code was working application and I convert library and import another application I got error Failed to resolve: org.xwalk:xwalk_core_library:18.48.477.13 – RDY Nov 25 '16 at 11:39

1 Answers1

9

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

File->New->Import Module

step 2 select the module and rename if you need

select the module and rename if you need

step 3 choose all the option

choose all the option

here android studio may ask you to update, update it

enter image description here

step 4 process the module dependency

process the module dependency enter image description here enter image description here

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

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

add hardware acceleration on to application node of AndroidManifest.xml

android:hardwareAccelerated="true"

add this to layout file

<org.xwalk.core.XWalkView 
 android:id="@+id/xWalkView"
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
</org.xwalk.core.XWalkView>

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

webview not support

XWalkView supports well

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

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


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

add this to layout

<org.xwalk.core.XWalkView android:id="@+id/webview"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
    </org.xwalk.core.XWalkView>

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);
LF00
  • 27,015
  • 29
  • 156
  • 295
  • Referring process – RDY Nov 29 '16 at 07:19
  • 1
    @RDY I create a new today, and I refresh my answer. – LF00 Nov 30 '16 at 06:34
  • 1
    https://github.com/punyfeir/TestCrosswalkEmbed2 this link help for me thank you @Kris – RDY Nov 30 '16 at 08:55
  • Am I correct in saying this only supports ARM? What if I wanted to support both x86 and ARM? I'm not sure which module I am meant to download and import. – RobVoisey Dec 12 '16 at 13:27
  • @RobVoisey no it can support many archicture. Refer to https://crosswalk-project.org/documentation/about/faq.html#Ways-to-use-the-Crosswalk-Project and https://crosswalk-project.org/documentation/getting_started.html – LF00 Dec 13 '16 at 01:36
  • @KrisRoofe yup, I knew that Crosswalk itself could but I meant that the answer only went into supporting ARM. I attempted following the documentation to support both in the same APK but could not figure it out; will try posting a new question. – RobVoisey Dec 13 '16 at 10:46
  • @RobVoisey I havn't try that. I also have that requirement of multi architecture support in one App. And its my next work. I'll begin it a very few days later. If I've some progress, I'll refresh the answer here and inform you. If you have some progress, share it. thanks. – LF00 Dec 13 '16 at 10:57
  • what version jar you used in source code.(github link)? – asad.qazi Aug 16 '21 at 07:03