android - 人行横道与 Eclipse 崩溃

标签 android eclipse crosswalk-runtime

我在本教程中将 Crosswalk 添加到 eclipse:ClickHere 我完全按照教程中的方式进行了所有操作,没有出现任何错误,但是当我在手机上启动该应用程序时,我得到了这个:

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

主要 Activity :

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>

我在谷歌上搜索了几个小时,但找不到解决方案。

最佳答案

我遇到了同样的问题并找到了解决方案:

记得在您的 Android list 中请求所需的权限:

<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" />

关于android - 人行横道与 Eclipse 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28606784/

相关文章:

eclipse - 是否有 SWT 调试器/ spy ?

javascript - 在 Crosswalk WebView 中查看控制台日志

java - 时间选择器 ontimeset 错误

Android 小部件不显示它的属性我要写时的建议

java - 如何使用 eclipse Google 应用引擎让 .jsp 调用方法

eclipse - Pydev + Eclipse 不对新项目进行代码分析

android - 我可以优化 Meteor Android Cordova 应用程序的首次加载时间吗?

android - 构建混合应用程序,从哪里开始?

Android SearchView 设置默认展开

javascript - 在android webview中注入(inject)javascript