You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/17 07:02:00 UTC

[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x

    [ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16617152#comment-16617152 ] 

ASF GitHub Bot commented on CB-9393:
------------------------------------

sandeep2244 commented on a change in pull request #544: CB-9393: Documenting how to embed a SystemWebView
URL: https://github.com/apache/cordova-docs/pull/544#discussion_r217961511
 
 

 ##########
 File path: www/docs/en/dev/guide/platforms/android/webview.md
 ##########
 @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins.
 If you're unfamiliar with Android, you should first familiarize
 yourself with the [Android Platform Guide](index.html) and have the latest Android
 SDK installed before you attempt the more unusual development option
-of embedding a WebView.  Starting with Cordova 1.9, the Android
-platform relies on a `CordovaWebView` component, which builds on a
-legacy `CordovaActivity` component that pre-dates the 1.9 release.
+of embedding a WebView.  Starting with Cordova 4.0, the Android
+platform relies on a `SystemWebView` component.
 
 1. To follow these instructions, make sure you have the latest Cordova
    distribution. Download it from
    [cordova.apache.org](http://cordova.apache.org) and unzip its
    Android package.
 
-1. Navigate to the Android package's `/framework` directory and run
-   `ant jar`. It creates the Cordova `.jar` file, formed as
-   `/framework/cordova-x.x.x.jar`.
+1. Create a project in Android Studio
 
-1. Copy the `.jar` file into the Android project's `/libs` directory.
+1. Copy the framework directory into your project's root directory and name it
+CordovaLib
+
+1. Add CordovaLib in your settings.gradle file
+
+include ':app', ':CordovaLib'
+
+1. Add that project as a library project to your main project.  This can be done in your application's build.gradle file found in
+app/build.gradle:
+
+        dependencies {
+              compile fileTree(dir: 'libs', include: ['*.jar'])
+              compile 'com.android.support:appcompat-v7:21.0.3'
+              //Add Cordova below
+              debugCompile project(path: ":CordovaLib", configuration: "debug")
+              releaseCompile project(path: ":CordovaLib", configuration: "release")
+        }
 
 1. Add the following to the application's `/res/xml/main.xml` file,
    with the `layout_height`, `layout_width` and `id` modified to suit
    the application:
 
-        <org.apache.cordova.CordovaWebView
+        <org.apache.cordova.engine.SystemWebView
             android:id="@+id/tutorialView"
             android:layout_width="match_parent"
             android:layout_height="match_parent" />
 
-1. Modify the activity so that it implements the `CordovaInterface`.
-   It should implement the included methods.  You may wish to copy
-   them from `/framework/src/org/apache/cordova/CordovaActivity.java`,
-   or else implement them on your own.  The following code fragment
-   shows a basic application that relies on the interface. Note how
-   the referenced view id matches the `id` attribute specified in the
-   XML fragment shown above:
-
-        public class CordovaViewTestActivity extends Activity implements CordovaInterface {
-            CordovaWebView cwv;
-            /* Called when the activity is first created. */
-            @Override
-            public void onCreate(Bundle savedInstanceState) {
-                super.onCreate(savedInstanceState);
-                setContentView(R.layout.main);
-                cwv = (CordovaWebView) findViewById(R.id.tutorialView);
-                Config.init(this);
-                cwv.loadUrl(Config.getStartUrl());
-            }
+1. Add the following code to setup your Activity so that you have an interface
 
-1. If the application needs to use the camera, implement the
-   following:
+        private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this);
+
+1. Add the following to intialize the WebView
 
 Review comment:
   what if i want to override 
   
   > setWebChromeClient(WebChromeClient client)
   
   method of systemWebView
   
   I got rutime error of class cast exception 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Embedded use case is undocumented for Cordova-Android 4.0.x
> -----------------------------------------------------------
>
>                 Key: CB-9393
>                 URL: https://issues.apache.org/jira/browse/CB-9393
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android
>    Affects Versions: 4.0.1
>            Reporter: Joe Bowser
>            Assignee: Joe Bowser
>            Priority: Major
>             Fix For: 5.0.0
>
>
> We broke the embedded webview use case for Android 4.0.x. and it's currently difficult to embed a webview without some gradle editing.  We should probably work on getting the Embedded WebView use case to work out of the box for Gradle, and in the meantime document all the workarounds for getting an embedded webview in Android Studio to actually work.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org