Giter Club home page Giter Club logo

webview-plus's Introduction

IMPORTANT: This project has been discontinued. For the latest Webview+ for Android, please go to the new Cocoon Cloud at http://cocoon.io.

The new Cocoon cloud is completely Cordova based and has enhanced features that include: the most up to date Webview+, new Cocoon plugins, a better Developer App, support for any Cordova plugin and a revamped UI.

Webview+ for Android

This project is a plugin for cordova/phonegap apps, and provides a uniform webview on any Android 4.x device..

Looking for Webview+ for iOs?

Webview+ Features, Advantages and Benefits

  • V8 Javascript VM
  • Works on Android 4.x
  • Latest HTML5 APIs
  • Compatible with Cordova Plugins
  • Better performance than system webview

Prerequisites

You'll need android SDK API level 19 installed in with your SDK tools.

How to install the Webview+ in your current project

Even though it's a cordova-compatible plugin, some steps must be done for the installation. If you prefer, you can install it automatically using the CocoonJS Command Line Interface.

The cocoonjs-cli has the same usage and commands of cordova-cli.

Once the cocoonjs-cli is installed in your system, just type:

// Install Ludei's CLI
$ sudo npm install -g cocoonjs

$ cocoonjs create MyProject
$ cd MyProject
$ cocoonjs platform add ios
$ cocoonjs plugin add com.ludei.webview.plus -d
$ cocoonjs run/emulate

The -d flag is used to activate the verbose mode.

Manual installation

The CocoonJS-CLI automates the installation of the Webview+, but if for some reason you want to install the Webview+ without the CocoonJS-CLI you’ll have to do the following steps.

These steps are specific for Cordova 3.4.0 and higher. If you want to install manually Webview+ in previous versions, please, refer to the hooks in the cocoonjs-cli

Step 1

Clone the Webview+ repository in your computer:

git clone https://github.com/ludei/webview-plus.git

Step 2

Edit the following file by using your favorite text editor

_PATH_TO_YOUR_CORDOVA_PROJECT_/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebview.java

Step 3

Find the following string inside CordovaWebview.java:

public class CordovaWebView extends WebView

Step 4

Replace the string you've found with these two strings:

import com.ludei.chromium.LudeiWebView;
public class CordovaWebView extends LudeiWebView 

Save and close the file

Step 5

Edit the following file:

_PATH_TO_YOUR_CORDOVA_PROJECT_/platforms/android/CordovaLib/project.properties

Step 6

Paste the following string and change the path after “android.library.reference.1=” to the relative path that points to your downloaded Webview+ (It must be a relative path and not an absolute path)

android.library.reference.1=../../../plugins/com.ludei.webview.plus/android

There you go. Now that you have installed the Webview+ in your project you can run the command “$ cordova build” and your app will benefit of the advantages of the Webview+.

If you want to know how the CocoonJS-CLI does these steps programatically, check the sources at android/hooks folder (after_plugin_add / after_plugin_rm).

Known bugs

  • Launching the Webview+ inside android's emulator can lead to an application crash. Use a real device for testing.
  • Current version may not reproduce sound files.
  • In some devices 3D context may not be created, this is due to a memory limitation of the device.
  • As android SDK API level 19 is required, if it is not installed properly in the machine, it will raise an "Unable to resolve project target 'Google Inc.:Google APIs:19'" compilation error. Here it is a step-by-step guide to solve this issue.

About the author

Ludei is a San Francisco based company, creators of CocoonJS. Ludei aims to empower HTML5 industry with a set of tools that eases the adoption of HTML5 as the target platform for every mobile development.

webview-plus's People

Contributors

karliky avatar keianhzo avatar libelulav avatar txusinho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webview-plus's Issues

Native calls result in an alert on Android devices < 4.2

Cordova version: 3.5.0-0.2.6
Webview+: 2.1.0

I tried to set up a sample project. Webview+ works fine on Android 4.2+ devices but fails on older devices (Android 4.0+ to < 4.2).
In Cordova, on Android devices < 4.2, a prompt bridge is used rather than exposing the JS interface. Result is that in Webview+ every command to native side triggers an alert dialog.

Steps to reproduce:

  • Cordova CLI
cordova create testwebviewplus com.example.testwebviewplus testWebviewplus
cd testwebviewplus/
cordova platform add android
cordova plugin add https://github.com/ludei/webview-plus.git
cordova prepare
  • Follow Webview+ README instructions from step 2 to 6
  • In Eclipse, import the 3 projects in testwebviewplus/
  • For Ludei Webview+ project, go to Properties/Android/Project Build Target and set it to Android 4.4.2
  • Clean the 3 projects and Run

Tested on:

  • Samsung Galaxy Tab 2 (7.0) GT-P3110, Android 4.1.2
  • Acer Iconia Tab A700, Android 4.1.1
  • Samsung Galaxy Tab Pro 10.1" SM-T520, Android 4.4.2
  • Google Nexus 7 ME370T, Android 4.2.2

Am I missing something?

"makeCall" function.

I have traced a number of Webview+ functionality issues to a CocoonJS JSON parsing error (trying to parse "") -- callbacks to the internal Java API that are failing and returning nothing.

This is the internal function I refer to:

['makeCall'] = function () {
 return JSON.parse (
  window.CocoonJSWebViewCallbackObject.CocoonJSMessageForResult (
   'cocoonjs://200' + JSON.stringify(window.cocoonjsCheckArgs.call (this, Array.prototype.slice.call(arguments)))
  )
 )
}

Multi select crashing app and single select not triggering native select android 4.1.2 samsung tablet

Simple html code with cordova and webview+ not showing select popup properly on my samsung tablet with android version 4.1.2 . But it has no problem on my samsung mobile(Grand I9082) with android version 4.2.2

Issues on android version 4.2.2, samsung tablet :

a) Single select - not triggering android native select popup but actually showing options with no background below the html select element
b) Multiple select - crashing app on clicking mutiple select.

    //code for single select
     <div class="input-label">
            <select>
                <option value="cell">Cell</option>
                <option value="phone">Phone</option>
                <option value="office">Office</option>
                <option value="fax">Fax</option>
                <option value="home">Home</option>
            </select>
        </div>

    //code for multiple  select
        <div class="input-label">
            <select multiple="multiple">
                <option value="cell">Cell</option>
                <option value="phone">Phone</option>
                <option value="office">Office</option>
                <option value="fax">Fax</option>
                <option value="home">Home</option>
            </select>
        </div>

Note: see top left of images for select input.

I have added two images(after_webview_plus & before_webview_plus) demonstrating issue with select input.

//after webview plus added

after_webview_plus

//before webview plus added

before_webview_plus

Second "untitled" WebView

There seems to be a second WebView named "untitled" in Chrome when I inspect my device (Chrome menu > More tools > Inspect devices). Is it a bug?
untitled_webview

Admob ad does not load in WebView+

When I use Cordova AdMob plugin in an app created using cordova CLI or cocoonjs CLI without using WebView+, it loads just fine. When I add the WebView+ plugin, the Ad does not appear.

Reproduction steps:

cocoonjs create testad/ com.testad testad
cd testad
cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus -d
cocoonjs plugin add com.google.cordova.admob

/*at this point I add my project to www/ which contains AdMob calls. The app's Admob Section:

if (AdMob) AdMob.createBanner({
    banner: ' ca-app-pub-xxxxxx'
});
*/

cocoonjs run android

Expected result: Ad loads at the bottom of the page.

Actual result: Ad is missing

Comment: If I skip the line that adds WebView+ plugin to the project, Ad appears on the page.

Configurations:
Cordova CLI 4.0.0
CordovaJS 3.6.4
CocoonJS 1.0.0-0.5.0
Android 4.4.2
Device: Nexus 7

What's missing/wrong?

Crash on app start with VFY: unable to resolve static field select_dialog_multichoice

I was really pleased when I've found your project. I tried to follow your readme and integrate webview+ (2.1.0) to my cordova 3.5 app, it compiles, builds and installs but crashes after startup with this log https://spodder.com/p/8b4DSvolflJc4PsiBW2h8Y3f .
My setup is OSX, Oracle JDK 6, Android SDK Tools 23.0.2, Android SDK Platform-Tools 20, Android SDK Build-Tools 19.1 (tried 20, but the same error), Android SDK Platform 19. A target is set to android-19 in all project.properties files. Should I change project configuration in any way to get it working?

Undesired prompt on app startup

I want to start using WebView+ in an existing cordova project.

To try it out, I started testing it on a brand new cordova project. It looks like it's working because when I log navigator.userAgent, I get something different if I include WebView+. However, I get an undesired prompt when the app starts. The prompt has a title ("Prompt"), a default value ("gap_init:2") and two buttons ("OK" and "Cancel"). If I press OK, everything seems to work. If I press Cancel, I just get a black screen.

Why does this prompt appear? How can I get rid of it?

Steps to reproduce:

$ cordova create a x.y.z myTest
$ cd a
$ cordova platform add android
$ cocoonjs plugin add com.ludei.webview.plus
$ cordova run --device android

More info

$ cordova -version
3.6.3-0.2.13

OpenSSL security alert issue

Your app is statically linking against a version of OpenSSL that has multiple security vulnerabilities.You should update OpenSSL as soon as possible.
The vulnerabilities were addressed in OpenSSL versions beginning with 1.0.1h, 1.0.0m, and 0.9.8za. To confirm your OpenSSL version, you can do a grep via ("$ unzip -p YourApp.apk | strings | grep "OpenSSL""). For more information about the vulnerability, please consult http://www.openssl.org/news/secadv_20140605.txt.
To confirm that you've upgraded correctly, upload the updated version to the Developer Console and check back after five hours.
Please note, while it's unclear whether these specific issues affect your application, applications with vulnerabilities that expose users to risk of compromise may be considered "dangerous products" and subject to removal from Google Play.

Received this security alert from Google regarding our newly submitted app.

I tracked down which plugin is causing this issue and narrowed it down to webview-plus. The command provided by Google showed me that, with webview-plus included, there is an OpenSSL v1.0.1e linked to our app. Removing webview-plus plugin and running the command doesn't show any OpenSSL version.

Can I verify if the team is aware of this? If you are, are you planning on fixing this to avoid the risk of Google Play taking down apps that have webview-plus installed?

WebView+ not being installed

Hi

I'm trying to get WebView+ installed for an existing Cordova project, and to do this, I run the following CLI commands:

cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus
cocoonjs build android

All of these commands run as expected with success messages; however, WebView+ does actually NOT get installed. The safest way to measure this is by looking at the produced .apk file, which comes in at 11mb - same as before.

Cordova CLI version: 4.1.2
CocoonJS CLI version: 1.0.0-0.8.0

I seem to be following the guide by the book, everything runs fine, but WebView+ is not installed. Can someone help out?

FYI, the same happens with the iOS build (using com.ludei.ios.webview.plus)

Font rendering changed between 2.0.0 and 2.2.0

Hello,

I recently updated my project from Webview-plus 2.0.0 to Webview-plus 2.2.0. Following this, I noticed that rendered text seems a bit off and less readable now.

Here are two screenshots illustrating the difference. Text style is arial; sans-serif; and 14px.

  • Webview-plus 2.0.0
    webviewplus200
  • Webview-plus 2.2.0
    webviewplus220

Is there a way to restore how it was rendered previously? Thanks.

No audio on start in Webview and Webview+. Works in Canvas.

(This is in the launcher. I'm on Android 4.4.2, Note 2. The compiled APK gives no sound at all. I tried both mp3 and ogg.)

Including this and the latest cocoon.min.js:

void function () {
 CocoonJS.Audio = function () {return this}
 CocoonJS.Audio.prototype = {
  audio    : null,
  setAudio : function (audio) {this.audio = audio; this.audio.load(); return this},
  loop     : function (loop) {return this},
  play     : function () {this.audio.volume = 0.5; this.audio.play(); return this},
  pause    : function () {this.audio.pause(); return this}
 }
} ()

void function () {
 CocoonJS.Music = function () {return this}
 CocoonJS.Music.prototype = {
  audio    : null,
  setAudio : function( audio ) {
   this.audio = audio
   this.audio.load()
   this.audio.addEventListener ('ended', function (audioEvent) {audioEvent.target.playing = false; console.log("Audio ends playing.")}, false)
   return this
  },
  loop     : function () {
   if (!this.audio) {console.log ("audio not present."); return}
   this.audio.loop = !this.audio.loop
   return this
  },
  play     : function () {if (!this.audio) {console.log ("audio not present."); return}
   if (this.audio.playing) return
   this.audio.playing = true
   this.audio.play ()
   return this
  },
  pause    : function () {
   if (!this.audio) {console.log ("audio not present."); return}
   this.audio.pause ()
   this.audio.playing = false
   return this
  }
 }
} ()

function play_music () { 
 var testaudio = new Audio(); testaudio.src = "resources/musics/music.ogg"
 testaudio.type = "audio/ogg"
 var cjs_music = new CocoonJS.Audio()
 cjs_music.setAudio (testaudio)
 testaudio.oncanplay = function () {
  cjs_music.play ()
 }
}

play_music ()
setTimeout (function () {play_music ()}, 3000)

document.body.style.width  = "500px"
document.body.style.height = "500px"
document.body.style.backgroundColor = "green"
document.body.addEventListener ('click', play_music)
document.body.addEventListener ('touchend', play_music)

No audio on start or in 3s, only on click.

Crash on App start on Samsung S3 hardware

I'm getting a crash on launch using webview+ on the following hardware device:

  • Samsung S3 Android 4.3

Testing on other Android devices like a Samsung S4 it seems to run fine. I thought this might be related to #10 but looking into it more it appears to be a different error.

I was able to get it working if I reverted to webview-plus revision to before this revision:

The fatal error seems to happen in the Chromium library

F/libc    ( 7112): Fatal signal 11 (SIGSEGV) at 0xfbadbeef (code=1), thread 7154 (Chrome_InProcRe)
F/chromium( 7112): [7112:7156:1005/204818:689383985:FATAL:thread_local_posix.cc(17)] Check failed: error == 0 (11 vs. 0)
F/libc    ( 7112): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 7156 (JavaBridge)

The whole error log:

Here's a simple cocoonjs project setup to reproduce it:

cocoonjs create testwebviewplus
cd testwebviewplus/
cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus
cocoonjs run android --device

Errors when launching:

Building by gradle on Android studio

I import the repository as a module in Android studio and try to build it with Cordova by Gradle but not ANT in cli.

The follow error was shown

Execution failed for task ':dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/Gaplo917/Android/sdk/build-tools/21.1.1/dx --dex --no-optimize --output /Users/Gaplo917/PhoneGapProejct/testCocoonjs/platforms/android/build/intermediates/dex/debug --input-list=/Users/Gaplo917/PhoneGapProejct/testCocoonjs/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/ludei/chromium/BuildConfig;

I think the root of the problem is the .jar files contains the BuildConfig file which will collide with the one generated by gradle. The proof is when I change the package name in AndroidMainifest.xml of webview+, ie. com.luidei.android.chromium instead of com.luidei.chromium. The project can be built with webview+ in "debug" type ONLY but not in "release".

Purpose : I successfully did a project of Some Native(Augmented Reality) + HTML5 Game with CordovaWebView, I want to accelerate the CordovaWebView by replacing the webview by webview+ to have the V8 complier on the low end model (Non 4.4 device and fix the 4.4.2 chromium bug https://code.google.com/p/chromium/issues/detail?id=315111).

Webview+ not debuggable using 2.4.2

The webview is not debuggable in Chrome anymore. The previous version worked fine using the Chrome dev tool "Inspect devices". But now the list of webviews is empty.

WebView+ breaks Phonegap Google Maps Plugin

When using webview+ although the app compiles fine it will not start producing just a blank page, running it on webview the project runs just fine.

Phonegap Google Maps Plugin: https://github.com/wf9a5m75/phonegap-googlemaps-plugin

To recreate the problem you just need to add the phonegap google maps plugin using
cocoonjs plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="YOUR_API_KEY_IS_HERE"

note: leaving out the API_KEY is fine for testing purposes

Very strange (incorrect) sequence of events for full screen (interstitial)/AD event listeners.

So far only tested in Webview+.

window.addEventListener ("touchstart", function () {console.log ('show'); CocoonJS.Ad.showFullScreen()})
CocoonJS.Ad.onFullScreenShown.addEventListener (function() {console.log ("onFullScreenShown")})
CocoonJS.Ad.onFullScreenHidden.addEventListener (function() {console.log ("onFullScreenHidden")})
CocoonJS.Ad.onFullScreenReady.addEventListener (function() {console.log ("onFullScreenReady")})
CocoonJS.Ad.preloadFullScreen()
  1. CocoonJS.Ad.preloadFullScreen() seems to do what you'd expect. onFullScreenReady is fired when the fullscreen ad is preloaded. That's fine.

  2. CocoonJS.Ad.showFullScreen(): shows the full screen ad. OK.

  3. onFullScreenShown fires when the ad is shown, and onFullScreenHidden fires when it's hidden (when the ad is closed).

Bug/feature:
4) showFullScreen() actually works as preloadFullScreen() if the screen isn't preloaded yet.

Definitely bugs:
5) Preloading sometimes stalls/times out and does not activate anything. The showFullScreen/preloadFullScreen function sometimes needs to be run multiple times. I understand sometimes nothing is available (potentially?), but we have seemingly no event to tell us this.

  1. For video interstitials, the ad event sequence is totally wrong: onFullScreenShown fires, then onFullScreenHidden, and then onFullScreenShown again, and then the ad displays. No event fires when the ad is closed.

  2. CocoonJS.Ad.preloadFullScreen() only runs once. Subsequent invocation does nothing.

Source code

Stupid question, but where's the source code? All I can find are JARs...

`deviceready` not firing

It seems that when I use WebView+ in an existing cordova project, deviceready is never fired. In the logs, I see the following messages:

I/chromium(31110): [31110:31110:1104/183626:124687323601:INFO:CONSOLE(1168)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1168)
I/chromium(31110): [31110:31110:1104/183626:124687327635:INFO:CONSOLE(1161)] "Channel not fired: onFileSystemPathsReady", source: file:///android_asset/www/cordova.js (1161)
I/chromium(31110): [31110:31110:1104/183626:124687331639:INFO:CONSOLE(1161)] "Channel not fired: onCordovaConnectionReady", source: file:///android_asset/www/cordova.js (1161)

The only change I make to obtain this erroneous behaviour is to add the WebView+ plugin (cocoonjs plugin add com.ludei.webview.plus) before running cordova build --release android. If I don't add the WebView+ plugin, the app works as expected.

$ cordova -version
3.6.3-0.2.13

Requires libs" armeabi-v7a and armeabi ".so

some phone mode run fail
终端型号 小米 HM NOTE 1TD 操作系统 android (SDK 版本:17) IMEI 864375025425662
CPU 型号 MT6592
load_library(linker.cpp:760): library "libmaliinstr.so" not found

努比亚 NX511J 操作系统 android (SDK 版本:21) IMEI 866769022343217
CPU 型号 Qualcomm Technologies, Inc MSM8939
/
联想 K50-T5 操作系统 android (SDK 版本:21) IMEI 866046023223791
CPU 型号 MT6752

Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.yezhubang.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.yezhubang.app-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libLudeiChromium.so"

Scroll flickering on webview+

Enviroment:
CocoonJS: 1.0.0-0.5.0
webview+: 2.1.0
Cordova: 3.5.0-0.2.4

This is regarding the performance issue mentioned here.

Description: When scrolling through a list of divs or images, top and bottom of the scroll div start flickering. Without webview+ (using regular webview), scrolling is smooth and this problem does not occure.

Reproducing the issue/Test case:

You should be able to see some flickering when scrolling through the green list.

Note: I discovered that if I remove div{overlflow:hidden} property, the issue gets solved and scrolling a list becomes smooth and without flickering. I did not want to raise the issue since I found this temporary solution but I thought this maybe needs to be brought to your attention anyway. Honestly I do not know the cause of this behaviour. if you think it is not related to cocoonjs chromium, please close the issue.

become white

when I turn the screen off and then turn it on ,it just become white . so How can I do ?I need help! And the cocoonjs show the splash "the power by ludei", How can I delete?

Manual installation - crash at launch

Cordova version: 3.5.0-0.2.7
Webview+: 2.2.0
Device: Samsung Galaxy Tab 2 (7.0) GT-P3110, Android 4.1.2

Hi, I tried to installed manually the latest version of Webview+ but without success.
I simply created a Cordova project, followed the Readme and ended up with this exception at startup:

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.ludei.chromium.R$attr
    at com.ludei.chromium.ResourceProvider.registerResources(ResourceProvider.java:16)
    at com.ludei.chromium.LudeiContentView.initialize(LudeiContentView.java:393)
    at com.ludei.chromium.LudeiContentView.<init>(LudeiContentView.java:55)
    at com.ludei.chromium.LudeiContentView.<init>(LudeiContentView.java:48)
    at com.ludei.chromium.LudeiWebView.<init>(LudeiWebView.java:40)
    at com.ludei.chromium.LudeiWebView.<init>(LudeiWebView.java:27)
    at com.ludei.chromium.LudeiWebView.<init>(LudeiWebView.java:22)
    at com.ludei.chromium.LudeiWebView.<init>(LudeiWebView.java:17)
    at org.apache.cordova.CordovaWebView.<init>(CordovaWebView.java:138)
    at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:272)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:307)
    at com.example.testwebviewplus.testwebviewplus.onCreate(testwebviewplus.java:31)
    at android.app.Activity.performCreate(Activity.java:5163)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
    at android.app.ActivityThread.access$600(ActivityThread.java:140)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4895)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
    at dalvik.system.NativeStart.main(Native Method)

Here is a simple bash to execute in an empty folder, tested on OSX 10.9.4, to reproduce the test:

npm install cordova
./node_modules/cordova/bin/cordova create testwebviewplus com.example.testwebviewplus testwebviewplus
cd testwebviewplus/
./../node_modules/cordova/bin/cordova platform add android
cd ../
git clone https://github.com/ludei/webview-plus.git
sed -i -e 's/^public class CordovaWebView extends WebView.*/import com.ludei.chromium.LudeiWebView;\'$'\npublic class CordovaWebView extends LudeiWebView {/' ./testwebviewplus/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java
grep -q 'android.library.reference.1=' ./testwebviewplus/platforms/android/CordovaLib/project.properties && sed -i -e 's/^android\.library\.reference\.1=.*/android.library.reference.1=..\/..\/..\/..\/webview-plus\/android/' ./testwebviewplus/platforms/android/CordovaLib/project.properties || sed -i -e '$ a\'$'\n''android.library.reference.1=..\/..\/..\/..\/webview-plus\/android' ./testwebviewplus/platforms/android/CordovaLib/project.properties
cd testwebviewplus/
./../node_modules/cordova/bin/cordova run

Any hints?

Cant debug with chrome://inspect when using webview+

When going to chrome://inspect to debug my app on the actual device I see my device and the app listed correctly but named "untitled" when I click inspect a blank window appears (where the debugger should be) and just hangs there.

Removing webview+ plugin fixes the problem.

LG G3 Lag Issues

Webview+ works great on older phones. Thanks! It also works well on the Sony D6603 4.4.4 android (1080p). But on the LG G3 4.4.2 the default webview is much faster with 3d transitions. Could it be because the webview+ isn't optimized for the quad hd phones while the default webview is? Maybe it's a vendor specific bug?

I am also using it on top of an existing cordova project and I am really happy with the plugin support. It's very good!

Another user experiencing the same issue. See the bottom of this thread: http://forum.ionicframework.com/t/animations-lag-on-android-smooth-on-ios/10326/35

Getting errors when using newer version of Android sdk

Sadly in my apps I need a newer sdk than the version 19.
While everything works fine on a 4.4.2 device I get the following error on a 5.0.2 device:

FATAL EXCEPTION: main
Process: jp.company.app, PID: 7671
java.lang.RuntimeException: Unable to start activity ComponentInfo{jp.company.app/jp.company.app.App}: android.webkit.MustOverrideException: abstract function called: must be overriden!
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.webkit.MustOverrideException: abstract function called: must be overriden!
    at android.webkit.WebSettings.setAcceptThirdPartyCookies(WebSettings.java:509)
    at com.android.webview.chromium.CookieManagerAdapter.setAcceptThirdPartyCookies(CookieManagerAdapter.java:50)
    at org.apache.cordova.CordovaWebView.initWebViewSettings(CordovaWebView.java:200)
    at org.apache.cordova.CordovaWebView.init(CordovaWebView.java:164)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:345)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:320)
    at jp.company.app.App.onCreate(App.java:31)
    at android.app.Activity.performCreate(Activity.java:5933)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
    ... 10 more

Any idea how I could fix it?
Having the source of WebView+ could help

Can't programatically capture Screenshot

I'm using this cordova plugin to try and capture screenshots of my app: https://github.com/gitawego/cordova-screenshot

I noticed that the I only get a black image for some reason. But if I use the normal WebView the plugin works and I can see the normal screenshot.

Here' s the relevant code from the plugin:
View view = webView.getRootView();
view.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);

Perhaps webview-plus doesn't support setDrawingCacheEnabled(true)?

Support for x86 device architectures

Correct me if I'm wrong, but it looks like the current webview+ only supports ARM. This is by far the most common architecture, but based on our applications statistics about 4% of our users are using an x86 device. Supporting those devices has required us generate a separate build based on Crosswalk x86 for Cordova.

Is this something that is planned or something that might be supported in the future?

source code and license

I can't seem to find any sourcecode for this plugin, as it appears to be committed in a compiled state. Am I looking in the wrong place or was this intended?

Could you also advise which software license this plugin is released under as there's no LICENSE.txt in the repo. In the current state (no license specified) the github terms state that

".. nobody else may reproduce, distribute, or create derivative works from your work"

This seems kind of crazy if it's part of a mobile app users distribute to their customers on app stores. Thanks.

Back button not working/bug

The back button event listener is not working after adding webview-plus plugin for android.

Steps to reproduce:

  1. cocoonjs create backbuttontest

  2. cd backbuttontest

  3. cocoonjs platform add android

  4. cocoonjs plugin add com.ludei.webview.plus

  5. Edit www/js/index.js, add "document.addEventListener('backbutton', function(){alert("Back Button Pressed!");});" into onDeviceReady function so that it looks like this:

onDeviceReady: function() {
app.receivedEvent('deviceready');
document.addEventListener('backbutton', function(){alert("Back Button Pressed!");});
},

  1. cocoonjs run android

When the app is launched, press the back button and the app will exit without triggering the event listener.
However, if you launch the app, press the home button (to bring it to background), open the app again (from background), press the back button and the event listener will get triggered.

Am I doing something wrong or what?

Black screen

Sometimes the app screen turns to black. It's easy to reproduce if you go the app switcher and back several times. Eventually the app turns black and the only way to fix it is killing it. I'm not sure if it's related but I get a lot of these through logcat:

W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.
W/AwContents(23278): nativeOnDraw failed; clearing to background color.

I'm getting this on a Nexus 5 with the latest updates, and a Nexus 7 (old version) with Cyanogenmod nightlies.

using native dropdows crashes app

I've tested this on a Nexus 4 (Android 4.4.4) and a LG P990 (Android 4.2.2 Cyanogen).

Cordova 3.5.0-0.2.6
Cocoonjs 1.0.0-0.5.0
webview plus 2.0.0

Steps to reproduce

  • create cordova project ($ cordova create test my.test.dropdown dropdown)
  • add android project ($ cordova platform add android)
  • add webview plus ($ cocoonjs plugin add com.ludei.webview.plus)
  • place following code in index.html
<select id="dropwdown">
                    <option value="1" > Text 1</option>
                    <option value="2" > Text 2</option>
                    <option value="3" > Text 3</option>
                    <option value="4" > Text 4</option>
                    <option value="5" > Text 5</option>
                </select>
  • run app ($ cordova run android)
  • touch on dropdown

With LundeiWebview the app crashes:

07-11 01:36:57.860: W/dalvikvm(25204): threadid=1: thread exiting with uncaught exception (group=0x40bff930)
07-11 01:36:57.870: E/AndroidRuntime(25204): FATAL EXCEPTION: main
07-11 01:36:57.870: E/AndroidRuntime(25204): java.lang.RuntimeException: Binary XML file line #17: You must supply a layout_height attribute.
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5615)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:5567)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:6093)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.AbsListView.generateLayoutParams(AbsListView.java:5749)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.AbsListView.generateLayoutParams(AbsListView.java:91)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.LayoutInflater.inflate(LayoutInflater.java:477)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:371)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at org.chromium.content.browser.input.SelectPopupAdapter.getView(SelectPopupAdapter.java:56)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.AbsListView.obtainView(AbsListView.java:2159)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.ListView.onMeasure(ListView.java:1158)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2438)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.View.measure(View.java:15525)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.Choreographer.doFrame(Choreographer.java:532)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.os.Handler.handleCallback(Handler.java:725)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.os.Handler.dispatchMessage(Handler.java:92)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.os.Looper.loop(Looper.java:137)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at android.app.ActivityThread.main(ActivityThread.java:5227)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at java.lang.reflect.Method.invokeNative(Native Method)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at java.lang.reflect.Method.invoke(Method.java:511)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
07-11 01:36:57.870: E/AndroidRuntime(25204):    at dalvik.system.NativeStart.main(Native Method)

When using the system webview a native dropdown menu will open as expected.

Full screen/interstitial ad sizing issues in Webview+.

I don't know if this is a problem in Webview+, or Mopub, or Admob... but it seems some of the full screen ads aren't resized to fit the screen properly. (they are too big) Rotating the phone may make this worse. The "x" button is always in the correct place and correctly sized, but the ads themselves are not.

I tried both with and without the resize feature in the cloud compiler.

Don't know what to think.

I really like the idea of copying the engine into the program/app for stability purposes. After making some CSS changes and other html changes, my jigsaw game (just on 4.4.2 Android Webview, Note 2) actually runs faster and better than Webview+ on many measures. Not using Webview+ this will greatly limit my audience since only the most recent Android versions can run it well.

In Webview+ I am contending with the earlier mentioned scrollbar corruption issue. The refresh rate starts out not too great and rapidly (a couple of minutes) ends in sub-1 FPS before a final crash. Note that there is no such slowdown in 4.4.2 Webview. I already mentioned the shading speed issue which seems to be a Chromium bug (perhaps), and the slowdown to crash issue is something Chromium also has, but not to such an extent.

Edit: I compiled with Crosswalk, and although the game doesn't slow down and then crash, there are (worse) flashing issues and speed issues as well. I guess a lot of it has to do with Chromium doing something totally horrible after I use CSS scaling (-webkit-transform) and Javascript to scale the page to the viewport.

A curious item is that if I start the profiler in Chrome while remote debugging, the game actually runs FASTER and does not degrade.

I guess the most pressing need for me personally is instructions or a way to set up the target Chromium version for the Webview+ build, if indeed most/all of these issues are (Chromium) regressions.

I'd like to once again invite you to look at my latest APK running Webview+, which I can email you if you'd like.

UserAgent shows old Chrome version 19.77.34.5

Enviroment:
CocoonJS: 1.0.0-0.5.0
webview+: 2.1.0
Cordova: 3.5.0-0.2.4

Description: Inquiring userAgent inside a webview+ of a new cocoonjs/cordova app using cocoonjs CLI shows old Chrome version which is 19.77.34.5. This version is causing performance issues to us.

Producing the issue: following the steps in First steps with CocoonJS CLI Page.

Everything was installed, built successfully I can confirm that webview+ is 100% installed, the LudeiTest app size has gone up to 50mb plus I was able to debug the new test app remotely and alert(navigator.useragent)

Expected Result: Chromium should have been updated 30+ version as stated in the plugin change.log

screenshot_02

screenshot_2014-07-28-12-52-45

screenshot_2014-07-28-12-55-06

Unable to connect to multiple WebSockets

Hey, I just realized that Webview+ is unable to connect to multple websockets.

Environment:
cocoonjs version: 1.0.0-0.5.0
Webview+ version: 2.0.0

I create a demo in order to reproduce this issue. (https://github.com/debianw/cocoonjsAndWebsockets)

Basically it creates 2 websocket connections to wss://echo.websocket.org/ and send a message. Webview+ can just handle 1 socket connection and doesn't accept more websocket connections.

you can try this code too into chrome inspector and you'll see how 2 websockets are created and send an echo message with success.

var w = new WebSocket("wss://echo.websocket.org/")
  , w2 = new WebSocket("wss://echo.websocket.org/");

w.id = 10;
w2.id = 11;

w.onopen = onOpen;
w.onmessage = onMessage;
w.onclose = onClose;
w.onerror = onErr;

w2.onopen = onOpen;
w2.onmessage = onMessage;
w2.onclose = onClose;
w2.onerror = onErr;

function onOpen () {
  console.log('connected: ', this.id);
  this.send('hello websocket! '+ this.id);
}

function onMessage (e) {
  console.log(e.data,' ',this.id);
}

function onErr (e) {
  console.log(e.data, ' ', this.id);
}

function onClose () {
  console.log('disconnected: ', this.id);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.