6

I added Crosswalk to eclipse as in this tutorial: ClickHere I did everything exactly as in the tutorial and got no errors, but as i start the app on my phone I have this:

02-19 13:37:08.147: E/AndroidRuntime(21108): FATAL EXCEPTION: main
02-19 13:37:08.147: E/AndroidRuntime(21108): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crosswalktest/com.example.crosswalktest.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class org.xwalk.core.XWalkView
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread.access$700(ActivityThread.java:134)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.os.Looper.loop(Looper.java:137)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread.main(ActivityThread.java:4867)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at java.lang.reflect.Method.invokeNative(Native Method)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at java.lang.reflect.Method.invoke(Method.java:511)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at dalvik.system.NativeStart.main(Native Method)
02-19 13:37:08.147: E/AndroidRuntime(21108): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class org.xwalk.core.XWalkView
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.Activity.setContentView(Activity.java:1901)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at com.example.crosswalktest.MainActivity.onCreate(MainActivity.java:17)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.Activity.performCreate(Activity.java:5047)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
02-19 13:37:08.147: E/AndroidRuntime(21108):    ... 11 more
02-19 13:37:08.147: E/AndroidRuntime(21108): Caused by: java.lang.reflect.InvocationTargetException
02-19 13:37:08.147: E/AndroidRuntime(21108):    at java.lang.reflect.Constructor.constructNative(Native Method)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
02-19 13:37:08.147: E/AndroidRuntime(21108):    ... 21 more
02-19 13:37:08.147: E/AndroidRuntime(21108): Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Use SharedXWalkView if you want to support shared mode
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:233)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:237)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper.init(ReflectionHelper.java:132)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper.loadClass(ReflectionHelper.java:199)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper$ConstructorHelper.loadConstructor(ReflectionHelper.java:37)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.ReflectionHelper.createInstance(ReflectionHelper.java:246)
02-19 13:37:08.147: E/AndroidRuntime(21108):    at org.xwalk.core.XWalkView.<init>(XWalkView.java:169)
02-19 13:37:08.147: E/AndroidRuntime(21108):    ... 24 more
02-19 13:37:08.147: E/AndroidRuntime(21108): Caused by: java.lang.RuntimeException: Use SharedXWalkView if you want to support shared mode
02-19 13:37:08.147: E/AndroidRuntime(21108):    ... 30 more

MainActivity:

public class MainActivity extends Activity {

private  XWalkView mXWalkView;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mXWalkView = (XWalkView) findViewById(R.id.AM);
    mXWalkView.load("http://crosswalk-project.org/", null);
  }

}

activity_main.xml:

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

I digged google for several hours but couldn't find a solution.

Qbul3kZ
  • 158
  • 2
  • 10
  • ndroid:layout_height="fill_parent" android:visibility="visible" tools:context=".MainActivity"> ??? – Vishnudev K Feb 19 '15 at 12:48
  • 2
    Did you ever find a solution? I have the same problem in Android Studio. I'm using the ARM version of the native library. What is `SharedXWalkView` about anyway? I don't see any documentation for it on the internet at all, not even crosswalk-project.org. Poorly documented open source /facepalm – Someone Somewhere Apr 02 '15 at 18:15
  • 1
    did you find the solution if yes please share.. – Shehzad Apr 16 '15 at 16:52
  • 1
    Same error here, any solution yet ? – webaba May 09 '15 at 23:49
  • @SomeoneSomewhere This is the reason why I remind my colleagues not to use this POS framework. It is really hard to use it without one. I am so sorry about the POS but it really is. There you go, I said it. – Neon Warge Jan 18 '16 at 13:53

5 Answers5

6

I had the same problem and found the solution:

Remember to ask for the needed permissions in your Android Manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Vingtoft
  • 13,368
  • 23
  • 86
  • 135
1

Try importing crosswalk-webview-14.43.343.11-arm(or any updated library that you are using) as library project in eclipse or android studio. That will resolve the issue. Add it as a library in your Project. In eclipse : Right Click on project->Properties->Add Library.

In Android Studio: Open module setting of your project->Press + button to import project->Add your crosswalk-webview-14.43.343.11-arm. After that in your project Add module dependency.

Simply referring jar wont work in some cases.

Developer
  • 81
  • 5
0

For me what did the trick was Downloading Android Arm+x86 version the other two versions do not seem to work.

hariszaman
  • 8,202
  • 2
  • 40
  • 59
0

Like Developer said, the jar file isn't enough, it's not a uber jar including everything

As modules:

  • Copy the sources files in your project folder
  • Inlude the module : File->New->New Module
  • Add the new module to your app module (right lick on app -> dependdencies -> + -> Module dependency
Kusan
  • 260
  • 1
  • 11
0

I had similar problem when embedding crosswalk to our gradle based project. It was only happening in Release builds. After trying to extends from XWalkActivity or using XWalkInitializer it was still failing, but I noticed that it fails in during reflection based method, when app is trying to init embeded library. Then I understood that it's caused by method obfuscation in proguard in our release build. After added exceptions in proguard configuration according to Crosswalk FAQ, and then also adding another rule to proguard to keep JavasriptInterface methods used in our project to interact between webview and native client, the problem was fixed. So I suggest to check your proguard rules if any.

Community
  • 1
  • 1
shtolik
  • 1,341
  • 22
  • 29