在android studio中嵌入人行横道 [英] embed crosswalk in android studio
问题描述
我是 android 编程和 android studio 的新手.我为我的项目研究了 crosswalk embed API 并尝试将它嵌入到 android studio 中.但我无法成功.甚至我都不知道如何嵌入具有 gradle 文件的 API.
I'm new about android programming and android studio. I researched crosswalk embed API for my project and tried to embed it in android studio. But I couldn't be succesfull. Even I don't know exactly how can embed an API that has gradle file or not.
也许是gradle系统有问题?简而言之,如何使用 android studio 一步一步地将 crosswalk-webview 嵌入到我的项目中?非常感谢你.
Maybe there is a problem with gradle system? In brief, how can I embed crosswalk-webview to my project with android studio step by step? Thanks a lot you.
推荐答案
以下内容:https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/
在应用程序文件夹中打开 AndroidStudio 到项目视图编辑 build.gradle:
Open AndroidStudio to project view in app folder edit build.gradle:
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'}}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'org.xwalk:xwalk_core_library:10.39.235.15'}
同步项目.
sync project.
在布局 xml 中添加此视图.
add this view in layout xml.
<org.xwalk.core.XWalkView
android:id="@+id/xwalkWebView"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
/>
在活动或片段中:
In activity or fragment:
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;
在 onCreate 中:
in onCreate:
XWalkView xWalkWebView=(XWalkView)findViewById(R.id.xwalkWebView);
xWalkWebView.clearCache(true);
xWalkWebView.load("http://...", null);
// turn on debugging
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
在使用开箱即用的 WebView 失败后,我在 android 4.3 和 4.4 上的 XWalkView 中成功使用了 WebRTC.我认为 android 5 Lollipop 与最新的 Chromium 不相上下.
I've successfully used WebRTC in XWalkView on android 4.3 and 4.4 after failing with the out of the box WebView. I think the android 5 Lollipop is up to par with latest chromium.
这篇关于在android studio中嵌入人行横道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!