Is anyone using Ant to build android apps?


#1

Hi there,

Is anyone here using the "Android Ant" exporter in the Introjucer/Projucer to build Android apps with JUCE? ...and if so, would you be happy to switch to Android Studio instead? Please post.

I'm asking because we are currently investing a lot in supporting Android Studio better. Supporting the old Ant exporter as well starts to make this more cumbersome. So we are contemplating whether it could be a good idea to deprecate and eventually remove it.

Android Studio is the development environment officially recommended by Google, and I'm not aware of any features that are missing from it compared to the Ant method, so I'd suggest to migrate to it.

Would be great to get the JUCE community's opinion on this!

Thanks,
Timur


#2

I moved over to Android Studio as soon as JUCE 4 was released. 

As long as I can do a release build with AS I am happy to drop Ant.


#3

I would still like to use a reliable command line building mechanism for Android apps. The notes you posted in the other thread about Android Studio hint that all is not rosy over there. Also, my current build is pretty customized because of integration with other 3rd party stuff (Samsung pro audio sdk, for instance). That said, I am still on JUCE 3, and although I will go to JUCE4 I can probably deal with adjusting my hacked together build process.


#4

I would still like to use a reliable command line building mechanism for Android apps. 

Yes, and that reliable command line building mechanism will be gradle, which is the same stuff that Android Studio does when you hit "build" except you can also invoke gradle from the command line.

It's not in there at the moment but we will post instructions on how to do that as soon as possible. Would that work for you as a replacement for ant? At the moment ant is using a different toolchain, while gradle will give you the possibility of building exactly the same thing as with Android Studio (+ you won't have to maintain an extra exporter as the Android Studio project is simultaneously also a gradle project)

The notes you posted in the other thread about Android Studio hint that all is not rosy over there.

The Android Studio stuff is improving. As we speak, the Google developers are actually fixing many of the bugs that we filed, so you can look forward to the situation improving significantly over the next weeks and months! I have no doubt that over time it will develop into a very stable and useable build system. What we are seeing now are childhood ailments, figuratively speaking.


#5

Update: I finally figured out how to build Android Studio from the command line:

  • make sure your gradle executable is in your PATH or otherwise invokable (it is typically here: /Applications/Android Studio.app/Contents/gradle/gradle-2.10/bin/gradle)
  • Go into your Terminal
  • cd yourProject/Builds/AndroidStudio
  • gradle wrapper
    (this will create the “gradle wrapper” script that will build the app from the command line in the next step)
  • ./gradlew assembleDebug
    (or assembleRelease, respectively)

Tested on Mac OS X, very likely to work on Linux as well. As for Windows, I don’t know, but I am guessing you would use gradlew.bat for the last step.


#6

I’m not using JUCE for Android yet. (only pure Java / Android Studio projects here…)
I’d ditch Ant and get all resources with Gradle and Android Studio.
It’s much better working and mature enough those days. as you’re not doing much supporting RTAS those days as it’s deprecated just be kind enough to add community patches if someone wants to fix deprecated stuff ;).
That’s my N cents…


#7

Yeah we’ll certainly keep doing that whenever possible, just like we do with RTAS, mingw, Windows XP, and all the other things we don’t officially “support”.


#8

tried debugging a simple app with few components in android studio with the native lldb debugger and it worked quite well. but the juce demo built in debug is unusable, it freeze and hangs for seconds after you try to interact with it


#9

Well yeah the Juce Demo was not written with mobile platforms or efficiency in mind at all, so please don’t assume that it (especially the Debug build!) is meant as a good example of how JUCE apps run on Android :wink:


#10

at least you should be able to press items on a listbox with more than 10 elements without having your beard to grow long below your knees :wink:


#11

As the topic is sticky anyway, I will bump this up shamelessly :wink:

Hi @timur,
I am trying your method, but I get the error, that the gradle needs to be at least 3.3.
I have Android Studio installed and updated it just now. Projucer shows 3.3 as default, but even if I enter gradle 3.2 and resave the project, the gradle wrapper comes back with this error:

 prompt> gradle wrapper

FAILURE: Build failed with an exception.

* Where:
Build file '/.../MyProject/Builds/Android/lib/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':lib'.
> Failed to apply plugin [id 'com.android.library']
   > Minimum supported Gradle version is 3.3. Current version is 3.2. If using the gradle wrapper, try editing the distributionUrl in /.../MyProject/Builds/Android/gradle/wrapper/gradle-wrapper.properties to gradle-3.3-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Do I need to update gradle separately? Anything else that I might have missed?

EDIT: nevermind, I downloaded the gradle from gradle.org/releases and copied it manually into Android Studio. I just forgot that the PATH was still pointing to the old version…

From that point it works as expected…


#12

You should be able to simply use the gradle wrapper that the Projucer puts into the Builds/Android folder. You don’t even need to install gradle for that. Simply execute:

./gradlew assembleDebug

in the Builds/Android folder. This will download the correct version of gradle for you.


#13