我已经将CrossWalkView导入到我的项目中,我正试图在应用程序中使用它,但当我将org.xwalk.core.XWalkView
标记添加到activity
时,我的应用程序会崩溃
我的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondActivity"
android:orientation="horizontal">
<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>
</LinearLayout>
我通过在top-level gradle
中添加flatDir{dirs 'libs'}
实现了Xwalkwiew库,如下所示:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
flatDir {
dirs 'libs'
}
}
}
在我的应用程序gradle中,我添加了implementation(name:'CrossWalkView', ext:'aar')
我的CrossWalkView.arr文件是xwalk_core_library-23.53.589.4-arm.aar
我已经尝试过用我能找到的一切方法来实现CrossWalkView,但在打开我使用org.xwalk.core.XWalkView
标签的SecondActivity
时,所有这些都导致了崩溃,只有当我删除它时,活动才会正常运行,不会崩溃
完全错误
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.player.wavenet/com.player.wavenet.SecondActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class org.xwalk.core.XWalkView
只需删除这行
xmlns:android="http://schemas.android.com/apk/res/android"
从这个
<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>