Access Android API via Haxe?

318 views
Skip to first unread message

Cukta

unread,
Jan 31, 2015, 12:37:22 PM1/31/15
to haxe...@googlegroups.com
I need to make a to-do list like app for a class project, however I'm having a hard time setting up the development environment for android, mainly  because I can't use the android emulator because I've an amd processor, and I can't get Android Studio to recognize my device. So I'm looking for other alternatives like Haxe or Titanium.

I know that if I want to access a java class I need to create extern class, but my questions is:

How doable it is and if is it recommended?

Filip Loster

unread,
Jan 31, 2015, 1:15:37 PM1/31/15
to haxe...@googlegroups.com
It's perfectly doable, you can call any android class from haxe as long as you are willing to write the extern function for each call you want to perform.

The real question is though if the haxe is the right solution in your case - if you want to do to-do like application using native android UI you won't benefint much from using haxe as you won't be able to test that without device / emulator regardless.

Andy Li

unread,
Jan 31, 2015, 1:53:37 PM1/31/15
to haxe...@googlegroups.com
Hi,

Firstly, we don't have to write extern for Java target anymore - just use -java-lib path/to/library.jar. In the case of Android, you can download a particular platform target version, then find the android.jar in the Android SDK platforms folder.

However, the setup of using haxe Java for Android development is slightly non-trivial. You will have to understand both haxe and Android pretty well to do so. You still need to use the Android SDK tools to compile and deploy to a device/emulator. That means, you better have a usable emulator and/or fix the Android Studio device connection problem. Or you have to do everything in the command line.

Here is how to use the command line tools:

Create an Android project using the android command line tool: android create project ... (See http://developer.android.com/tools/help/android.html).

Use "-java ." to output to the top-level of the Android project. Notice the Java sources will be placed inside "src" folder. Use -D no-compilation to prevent haxe to compile the java output using the JDK, which is likely to produce jar that wouldn't work on Android. Instead, use the Android SDK build tools to build the Java output (ant debug) and deploy to a device (ant installd).

Of course, instead of using the haxe Java target with the Android SDK, you may use OpenFL, or Titanium, or even Processing. All of them can be used in haxe in someway.
Hope it helps.

Best,
Andy

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Rafael Oliveira

unread,
Jan 31, 2015, 4:10:45 PM1/31/15
to haxe...@googlegroups.com
https://github.com/Randonee/BasisAndroid

I didn't test, but it seems you can write native android apps with haxe. more info:

Its listed on the haxe site
Message has been deleted

Marcelo de Moraes Serpa

unread,
Jan 31, 2015, 4:31:49 PM1/31/15
to haxe...@googlegroups.com
Btw, do we have any examples of real-world applications developed using Basis (iOS, Android, Mac)?


On Jan 31, 2015, at 3:14 PM, Rafael Oliveira <rafa...@gmail.com> wrote:

https://github.com/Randonee/BasisAndroid

I didn't test, but it seems you can write native android apps with haxe. more info:

Its listed on the haxe site

Em sábado, 31 de janeiro de 2015 15:37:22 UTC-2, Cukta escreveu:
Reply all
Reply to author
Forward
0 new messages