Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
511 views
in Technique[技术] by (71.8m points)

build.gradle - embed crosswalk in android studio

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Following: https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/

  1. 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'}
    
  2. sync project.

  3. 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"
    />
    
  4. In activity or fragment:

    import org.xwalk.core.XWalkPreferences;
    import org.xwalk.core.XWalkView;
    
  5. 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);
    

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...