Native Extensions

Ohhhh lovely. Does it mean we can also pass audio buffers and do chiptunes on the fly?

4 Likes

Not yet, but thatā€™s one of our goals :slight_smile:

3 Likes

the ultimate chiptune engine! I am sold

4 Likes

Tiny teaser for AdMob support for Android:

We are continuing our effort to add Android support to Native Extensions, and today we managed to get our example app running. Itā€™s a big milestone in that it tells us a lot about what we need to do in order to make this a usable feature for the users.

Cheers!

20 Likes

I know the updates are few and far between, and I can only apologise and I hope to better our update rate :slight_smile:

The good news is that weā€™ve made good progress on the android support and if all goes well, weā€™ll have full android support in our next release (C/C++, Jar files, Java, resources)

Today we were able to build our AdMob example properly (I.e. No hacks or workarounds) through the editor for Android, and now weā€™ll make our admob example more presentable so that you can try it out soon (iOS + Android) for yourselves :slight_smile:

As a a Friday teaser, please enjoy a repost of the last image ^^

16 Likes

Yay! Great news. How about AAR files? Many SDKs now provide AAR instead of JAR.
And have you incorporated multidex support already or is it planned for later?

1 Like

The AAR support is in the back log, and Iā€™ll create a ticket for the multidex support.
I believe both will be resolved after weā€™ve added support for all platforms.

7 Likes

I canā€™t find all defines for NE (for ex. DM_PLATFORM_OSX and etc)
Is it possible to add list to the documentation? It would be great!
Thanks!

1 Like

Yes, there are quite a few things we need to setup better documentation for, and all the available flags, etc is definitely amongst them. Iā€™m going to start rolling that ball at least.

In the meantime, the current platform defines are:

  • DM_PLATFORM_OSX
  • DM_PLATFORM_IOS
  • DM_PLATFORM_ANDROID

(I wonā€™t add the others yet, since they havenā€™t passed review yet)

3 Likes

So, with the release of 1.2.103, weā€™ve added full support for Android builds with java, jar files and resource files. I will add a simple example of this on our github today to get you going.

Until then (for those eager to jump on the boat), you can try:

  • Add .java files to your myextension/src/ folder
  • Add .jar files to your myextension/lib/armv7-android folder
  • Add JNI calls to java in your cpp source, to call your java/jar code
  • Add resource files to your myextension/res/android/res folder (for resources to be put in the R.java)
8 Likes

Iā€™ve added a test project to demonstrate the full Android support here: https://github.com/defold/extension-android

Itā€™s a simple example that demonstrates the use of Android resources, .jar files, .java files and JNI and some native functionality (vibration).

13 Likes

HI again!

This time I just wanted to let you know that weā€™ve started with the HTML5 support for native extensions, and we have managed to get the server to compile and link the engine. A good start. Next up is compiling the actual extensions, which should be a relatively easy task. And next after that, weā€™ll look into adding support for adding ā€œ.jsā€ files into the /lib folder.

I know some of you are curious about the potential WebAssembly support, and although we wonā€™t add it right away (weā€™re still on Emscripten 1.35), it doesnā€™t seem like itā€™s going to be a very big task to support it once it goes into the next Emscripten stable version.

8 Likes

Sounds great. Just to clarify, if you know, will I be able to compile the OpenAL extension or will I have to rewrite it in JavaScript?

It seems like Emscripten supports OpenAL out of the box: https://github.com/kripken/emscripten/issues/666

1 Like

I trying to make Android version of DefUnityAds, and I have a question:
I need to add some activities and permissions to manifest file, and I donā€™t know how to do it (I want to save simple installation like a library )
Maybe you have some tool or something for auto merge android.manifest or auto adding some library parameters to manifest?
If not then would be great to have this feature.

Yes, you have to create your own manifest at the moment, and link to it via the project settings. You should find our AndroidManifest template under the editor folders Copy Manifest

I think manifest stubs are a feature of AAR files, so hopefully weā€™ll get that feature later on when we add that

1 Like

Do you have any approximate estimates about implementation supports of *.aar? (just want to understand should I work with jar, or have sense to wait)

Sorry, no good estimate other than that itā€™ll probably happen after all platforms are supported. We rarely change the manifest though so you should be able to start using jars for now.

3 Likes

One more question:
How to use imports in java from my jar file?
For now I receive message that package not exist, but my jar file in ā€œlib/androidā€ folder.
(unfortunately I canā€™t find information about ext.manifest parameters for java sources compilation)

@Mathias_Westerdahl can you help me with it? This is my blocker for now (

I would think you should be able to just reference the package name + class in your Java file. Say you have a Jar which has the following class and package; com.agulev.MyClass, then you should be able to import it in your Java as;

import com.agulev.MyClass;
...

If this does not work, let us know and we will try to debug it here.