WebView being moved to Native Extension

With Defold release 1.2.146 we are moving the previous core module webview into an external native extension library.

If you previously were using webview , you will need to add the following URL to your dependencies in game.project :



As presented in out roadmap for H1 2019, we are in the process of making the engine runtime more modular.

During H1-2019 we will use this system to extract non-vital parts of the engine core into native extensions, thus giving users even better control of what to include in the engine core, as well as opening up for community collaboration and improvements. We will start by extracting the webview into a native extension and then move on to also extract push, iap, iac and the Facebook SDK.

The webview module is our first step in this direction, it’s a good candidate for us to learn what removing modules from the core would mean for both us and our users.


Only a stub implementation is left in engine core, it will throw a Lua error if any webview function is used on mobile. The error will look like this:

webview has been removed from core, please read /builtins/docs/webview.md for more information.


The documentation for webview is now available here: https://defold.github.io/extension-webview/


  • The code editor inside Defold will no longer display code completion for the webview namespace. We are looking into a general solution for this, where libraries/extensions can expose code completions. However, this feature will not be available in 1.2.146 and we are sorry for the inconvenience. The issue ID for this feature is: DEFEDIT-1532


We are open for your feedback and would like to hear any suggestions how we can make this new direction as painless as possible for our users. If you have any suggestions or annoyances how this new direction will affect you, please reply to this topic!


You will continue use old doc format for webview, or it will use another format? Prev was json, now you use yml, if i understand right.

EmmyLua use lua annotations(something like luadoc) to describe params,functions,types. It is very easy to use it. If in library we can use annotations in lua to make autocomple it will be cool and easy for users. https://emmylua.github.io/annotations/return.html

1 Like

We have a meeting on Thursday to discuss and hopefully agree on a format for documenting extensions so that the editor can provide autocomplete. I haven’t heard of EmmyLua before but I’ll take a look at it for sure!


I think I’m missing something. The goal wasn’t to disable webview completely, right? Just to switch from a core module to an extension.

I’m using the Defold 1.2.150 with Mac OS 10.12.6 building to a Samsung Galaxy S7. I have a new project using the extension-webview URL above and dirtylarry, which both load into the project fine. I get the following error:

ERROR:SCRIPT: /main/main.gui_script:54: webview has been removed from core, please read /builtins/docs/webview.md for more information.
stack traceback:
[C]: in function 'create'

webview_available() returns true. In fact, I can pprint(webview) and get a list of functions. So, as far as I know, I am trying to use webview as an extension. What am I missing?

1 Like

Can you confirm if you download and build the example project it doesn’t work?

Also did you install an apk built after adding the NE to your phone?

Yes, I used the example project both by including https://github.com/defold/extension-webview/archive/master.zip as a dependency (then manually creating the script), and in a different project by downloading the zip, unzipping it, and dragging all the files into Defold. On the device, I installed the most recent version of dmengine and used that as the Target. The dirtylarry buttons show up on the device.

Can you download the example and test it just to be sure? I don’t mean including the NE in your own project.

By most recent version of dmengine do you mean one from d.defold.com or one you actually built which includes the NE code?

and dragging all the files into Defold.

No need to do that. Unzip and double click on game.project.

dmengine came from engine/armv7-android/dmengine.apk link from the 1.2.150 release at d.defold.com.

I downloaded https://github.com/defold/extension-webview/archive/master.zip, unzipped it and double-clicked on game.project. When defold came up, I connected to my device under Target, and chose Build. The output in the console was:

INFO:ENGINE: Defold Engine 1.2.150 (e79cdec)
INFO:ENGINE: Loading data from:
INFO:ENGINE: Initialised sound device 'default'

ERROR:SCRIPT: /main/main.gui_script:54: webview has been removed from core, please read 
   /builtins/docs/webview.md for more information.
     stack traceback:
    [C]: in function 'create'
    /main/main.gui_script:54: in function </main/main.gui_script:48>
ERROR:GAMESYS: Error when initializing gui component: -2.
WARNING:ENGINE: Unknown Android input method [KeyEvent], defaulting to key events

On the device, are 3 buttons (“Open www.google.com”, “Show”, “Hide”). When I hit the “Open” button, I get these additional lines in the console:

ERROR:SCRIPT: /main/main.gui_script:66: webview has been removed from core, please read 
/builtins/docs/webview.md for more information.
stack traceback:
    [C]: in function 'open'
    /main/main.gui_script:66: in function 'cb'
    /dirtylarry/dirtylarry.lua:67: in function 'button'
    /main/main.gui_script:63: in function </main/main.gui_script:62>

The issue is that you are running an engine without the webview components built in (the one downloaded from d.defold.com is a “vanilla” build, without any extensions).

It’s not possible to build and launch a completely different engine binary directly to the device from the editor.

The solution is to bundle your project once for Android, install that APK to your device instead. Then you will be running a binary that has webview included, so you will be able to run “Build & Launch” to it as a target.


Thanks for sticking with me. I knew I was missing something fundamental. OK. So, now I am set up building an apk and seeing debug messages with adb. When I run on the device, the webview table is nil and I get the debug message from webview_available().

I thought that maybe I had to do some manual steps outside of defold, so I tried the example https://github.com/defold/extension-android using the same process (download zip, double-click the project file, defold Bundle apk, copy apk to device, install on device, run on device (including adb over usb)). The extension-android example runs fine on the device. I’ll try a few more examples and see whether I can narrow down which ones I have issues with.

I am trying to digest the Extensions Manual (https://www.defold.com/manuals/extensions/) but I’m not not yet understanding how a table from an extension becomes available in the namespace of a script. There is no require so it is compiled in at some point and makes itself available to lua.


Exactly. Extensions declare their public Lua API in the extension init code. This usually means creating one or more tables on the Lua global table.


Hi all,

It seems something was wrong when I bundled to Android with the same sample project from https://github.com/defold/extension-webview. My config is: Defold - 1.2.157, MacOS Mojave

07-08 18:43:28.176 7992 8010 E defold : ERROR:SCRIPT: main/main.gui_script:66: webview has been removed from core, please read /builtins/docs/webview.md for more information.
07-08 18:43:28.176 7992 8010 E defold : stack traceback:
07-08 18:43:28.176 7992 8010 E defold : [C]: in function ‘open’
07-08 18:43:28.176 7992 8010 E defold : main/main.gui_script:66: in function ‘cb’
07-08 18:43:28.176 7992 8010 E defold : dirtylarry/dirtylarry.lua:67: in function ‘button’
07-08 18:43:28.176 7992 8010 E defold : main/main.gui_script:63: in function <main/main.gui_script:62>

My process: download zip, open project, Project-> Bundle->Android, copy apk to device, install, run on device with no success.

Is there any way to check the webview component has been include in apk file?

Thank you


That’s strange, I just tried the same here and it works. Bundled the extension-webview project for Android and installed it (via adb)… :thinking:

You haven’t done any changes to the project, or changed the build server URL preferences?

thanks sven,

I tried both: via adb and manually copy to device, my device is Asus Zenfon4, Android 8.1.0. So if it is bundled as your instructions, the reason maybe is webview could not be invoked?

After error running built with older Defold version, I make a fresh config (download Defold 1.2.157, download webview as zip, run project file, build successfully) with no modification anything, my Extensions config as follow:

Hi sven,

Could you please send me the app at your build?

Thank you very much!

Sent you a PM.

1 Like

The problem is still relevant.
Defold 1.2.158
Platforms iOS, Android
When using webview, the error “webview has been removed from core” crashes.
Build with

Prodject->Bundle->ios(android) application


I found the issue and made a PR, I think we will merge it tomorrow.


Merged into master, should be fine now.