Where in .java template for Android ant?

The following only counts for the windows version of Android Studio (and Visual Studio 2015). Strangely enough the Projucer 4.2.4 Android Studio projects makes fine on MAC (!?)

The .java file that is used when Projucer 4.2.4 creates exporters for Androis has statements, that are deprecated so you must change the .java source. Thus I’d like to know where I find the .java template, that Projucer 4.2.4 uses:

To compile an Android Studio project created with Projucer 4.2.4 you must make the following changes to the .java file (HelloWorld.java in this case):

.java file line 59 and 60 must be changed like this (see notes belov from https://developer.android.com/reference):
import android.content.Context;
//import android.support.v4.content.ContextCompat;
import android.app.Activity;
//import android.support.v4.app.ActivityCompat;

they write:
This constructor is deprecated. Do not use this constructor. It will be removed and replaced with a protected constructor in a future release.
Public methods

and On
they write
Public constructors
This constructor is deprecated. Do not use this constructor. It will be removed and replaced with a protected constructor in a future release.

.java file line 122 must be changed like this:
return checkSelfPermission (getAndroidPermissionName (permissionID)) == PackageManager.PERMISSION_GRANTED;
// return ContextCompat.checkSelfPermission (this, getAndroidPermissionName (permissionID)) == PackageManager.PERMISSION_GRANTED;

.java file line 131 must be changed like this:
if (checkSelfPermission (permissionName) != PackageManager.PERMISSION_GRANTED)
// if (ContextCompat.checkSelfPermission (this, permissionName) != PackageManager.PERMISSION_GRANTED)

.java file line 135 must be changed like this:
requestPermissions (new String[]{permissionName}, permissionID);
// ActivityCompat.requestPermissions (this, new String[]{permissionName}, permissionID);

Further: to compile Android ant project imported to Visual Studio 2015 (as Eclipse project) you have to make this change:
in build.xml line 23
…"{ndk.dir}/ndk-build"... must be changed to: ..."{ndk.dir}/ndk-build.cmd"…

Hi ekrogh,

As far as I know, Google will be deprecating the Android ANT build system and we plan to do the same. I’m not sure why Visual Studio has a problem importing the ant project but you should be able to import the Android Studio project fine.

One reason why we kept the ANT build system was that it is easier to build the project from the command line. With the latest version of JUCE on develop, however, you can now also build your Android studio project, by typing in ./gradlew installDebug (on Mac/Linux) or gradlew installDebug (on Windows) in the AndroidStudio build folder of your JUCE project. Visual Studio should be able to import this project.


Hi Fabian

I still can’t find out how to import the AS project to Visual studio 2015. If I choose
File->New->Import Android Projects From Eclipse
I can

  1. Add project. Then I must open a file with the name “AndroidManifest.xml”
  2. Add workspace. But then I don’t know which folder to open. I always get the message “Please specify a valid Eclipse workspace.”

If I type in gradlew installDebug (on Windows) I get this error:

D:\projects\juceProjs\JUCE\examples\HelloWorld\Builds\AndroidStudio>“D:\Users\eks\Library\Android\sdk\tools\templates\gradle\wrapper\gradlew.bat” gradlew installDebug

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\projects\juceProjs\JUCE\examples\HelloWorld\Builds\AndroidStudio\app\build.gradle’ line: 1

  • What went wrong:
    A problem occurred evaluating project ‘:app’.


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


Total time: 1.541 secs



BTW: Besides building android ant projects in Visual studio 2015 I can also debug the projects using ADB to manually install the APK in the VS Android simulators (Deploy unchecked in Configuration Manager).