Transition Using Eclipse

I added Crosswalk for the eclipse, as in this tutorial: ClickHere I did everything exactly as in the tutorial, and did not get any errors, but when I launched the application on my phone, I have the following:

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 dug google for several hours but could not find a solution.

+6
source share
5 answers

I had the same problem and found a solution:

Remember to request the necessary 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" /> 
+6
source

Try importing crosswalk-webview-14.43.343.11-arm (or any updated library that you use) as a library project in eclipse or android studio. This will solve the problem. Add it as a library to your project. In the eclipse: Right-click on the project-> Properties-> Add Library.

In Android Studio: Open the module settings of your project β†’ Press the + button to import the project-> Add your pedestrian jumper-14.43.343.11-arm. After that, add a module dependency in your project.

A simple jar call will not work in some cases.

+1
source

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

0
source

As the developer said, the jar file is not enough, it is not a uber jar, including all

As modules:

  • Copy source files to project folder
  • Enable Module: File-> New-> New Module
  • Add a new module to your application module (on the right lick the application β†’ dependdencies β†’ + β†’ module dependency
0
source

I had a similar problem when embedding a pedestrian crossing in our gradle project. This only happened in Release versions. After trying to expand from XWalkActivity or using XWalkInitializer, it still failed, but I noticed that it did not work during the reflection method, when the application tried to initialize the built-in library. Then I realized that this was caused by the confusion of the method in proguard in our release build. After adding exceptions to the proguard configuration in accordance with the Transition Frequently Asked Questions , and then adding another protection rule to save the JavasriptInterface methods used in our project for interaction between web browsing and our own client, the problem was fixed. Therefore, I suggest checking your proguard rules, if any.

0
source

Source: https://habr.com/ru/post/982734/


All Articles