Native Extensions


#21

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


#22

Not yet, but that’s one of our goals :slight_smile:


#23

the ultimate chiptune engine! I am sold


#24

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!


#25

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 ^^


#26

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?


#27

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.


#28

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!


#29

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)


#30

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)

#31

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).


#32

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.


#33

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?


#34

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


#35

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.


#36

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


#37

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)


#38

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.


#39

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 (


#40

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.