2

我正在尝试使用 xwalkview 构建混合应用程序,但不断收到此错误。我添加了 crosswalk-webview-arm 库和 appcompat-v7 库和 2 个罐子。android-support-v4 jar 和 xwalk-core-library.jar。删除其中任何一个都会产生编译时间错误。

android_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hcp_android.NewMainActivity" >


  <org.xwalk.core.XWalkView 
    android:id="@+id/webPage"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
     />

新MainActivity.java

public class NewMainActivity extends Activity {
XWalkView xwalkview;
MediaPlayer ringtone;
AndroidJSInterface jSInterface;
boolean doubleBackToExitPressedOnce = false;
int k = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    xwalkview=(XWalkView)findViewById(R.id.webPage);
    jSInterface = new AndroidJSInterface(this);
    xwalkview.addJavascriptInterface(jSInterface, "AndroidJSInterface");
    xwalkview.load("file:///android_asset/login.html", null);
}
4

2 回答 2

0

我想这应该是so库冲突的结果,在build.gradle的productreading中:

ndk {
      abiFilters "armeabi", "x86"
}
于 2018-01-18T09:41:23.727 回答
0

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

请记住在您的 Android 清单中请求所需的权限:

<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" />
于 2017-03-27T11:36:09.783 回答