No Android targets available after Android Studio upgrade to 2.3

Hi

My name is Jens Páll and I’ve just started exploring jMonkeyEngine. I have been going through the beginner’s tutorials over the last few days and everything is working fine. jME is looking promising.

Since a small part of my game will be running on Android I configured the jME3 SDK to be able to build for Android by following the instructions here: https://jmonkeyengine.github.io/wiki/jme3/android.html.

I managed to build successfully for Android 6.0 (did not deploy to the phone though) but then I noticed Android Studio was offering an upgrade which I went through with (regrettably). This upgraded the Studio from 2.2.3 to 2.3. After this upgrade the Android target list in jME is empty. Also, clicking the ‘Run Android Target Configuration Utility’ produces the following message:

The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

This is the same output you get if the ‘android’ command is run from the command line so it seems google is moving things around a bit and thus breaking the Android support in jME.

I guess my options are the following:

  • Downgrade the Android SDK back to 2.2.3
  • Upgrade jME to the bleeding edge if this has been fixed there.

Will a jME upgrade fix this or is there something else I can try?

I’m running this on Arch Linux. Here’s what the jME SDK about window says:

Product Version: jMonkeyEngine SDK 3.1.0-stable-FINAL
Updates: jMonkeyEngine SDK is updated to version NetBeans 8.2 Patch 1
Java: 1.8.0_111; Java HotSpot™ 64-Bit Server VM 25.111-b14
Runtime: Java™ SE Runtime Environment 1.8.0_111-b14
System: Linux version 4.9.11-1-ARCH running on amd64; UTF-8; en_US (jmonkeyplatform)
User directory: /home/jens/.jmonkeyplatform/3.1.0-stable-FINAL
Cache directory: /home/jens/.jmonkeyplatform/3.1.0-stable-FINAL/var/cache

Thanks,
JP

2 Likes

Try this:

1 Like

Thanks aegroto, I’ll definitely look into BootMonkey and the Android template.

Am I understanding things correctly that the SDK is being abandoned? If that’s true it’s a pity since the tools it provides are really great, at least for a beginner like me.

1 Like

It is not abandoned but because every one is using crap intellij noone told us about your issue so far.

Feel free to create an issue and if you feel bored maybe even a pull request :slight_smile:

It is not being abandoned but after the lead manteiners of the source left the project it has not been constantly updated for some time. Fortunately,some awesome monkeys are still working on it :slight_smile: And it’s always good for an engine to be IDE-agnostic and have a way to boot project without need to download a weighty SDK.

Ah, I see :slight_smile:

I will be going off the deep end but I’ll take a look.

Who was it that left?

I still use this amazing SDK. I also use the direct blender import and it works :smile:
Keep up the good work.

Sorry but i don’t really remember his nick :\

I created issue #117 describing this.

1 Like

I installed Android SDK 25.2.5, which has a working android command, and I now get a populated Android target drop-down.

My project builds successfully but when I try to run it I get the following exception:

...
Creating full resource package...
Current build type is different than previous build: forced apkbuilder run.
Creating MyGame-debug-unaligned.apk and signing it with a debug key...
/home/jens/java/jmonkeyengine/projects/HelloCollision/nbproject/mobile-impl.xml:10: The following error occurred while executing this line:
/home/jens/android/sdk-tools-25.2.3/tools/ant/build.xml:958: The following error occurred while executing this line:
/home/jens/android/sdk-tools-25.2.3/tools/ant/build.xml:969: The following error occurred while executing this line:
/home/jens/android/sdk-tools-25.2.3/tools/ant/build.xml:312: 
java.lang.InternalError: Could not obtain X500Principal access
	at sun.security.x509.X500Name.<clinit>(X500Name.java:1399)
	at com.android.sdklib.internal.build.SignedJarBuilder.writeSignatureBlock(SignedJarBuilder.java:384)
	at com.android.sdklib.internal.build.SignedJarBuilder.close(SignedJarBuilder.java:273)
	at com.android.sdklib.build.ApkBuilder.sealApk(ApkBuilder.java:795)
	at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:371)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.<init>(sun.security.x509.X500Name)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.security.x509.X500Name.<clinit>(X500Name.java:1392)
	... 75 more
Caused by: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.<init>(sun.security.x509.X500Name)
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.getDeclaredConstructor(Class.java:2178)
	at sun.security.x509.X500Name$1.run(X500Name.java:1384)
	at sun.security.x509.X500Name$1.run(X500Name.java:1380)
	... 77 more
BUILD FAILED (total time: 6 seconds)

I get the same error with either OpenJDK 8 or Oracle JDK 8.

Any thoughts on why this happens?

I managed to deploy my project onto the phone by performing the following steps:

  1. Build the project in jME (do not run it)
  2. Import the resulting jME ‘mobile’ directory into Android Studio
  3. When Studio asks, convert the project to use gradle
  4. Upgrade gradle if asked to do so to enable instant run
  5. Connect the phone
  6. Run the Studio project (the phone automatically runs the app)

This worked, much to my surprise, but it’s a bit of a hassle to have to jump through these hoops every time I want to test on the phone. Hence, it would be great if I could get this working from within the jME SDK.

Did you use my template,initializing it with BootMonkey? I never saw that exception and i always worked using only JME SDK.

@aegroto: No I haven’t done that yet but I think that’s my next step. I have been trying to understand where this error is coming from and it seems it’s netbeans 8.2 and JDK 8 specific, that is, that particular combination. That’s at least what other projects unrelated to jME are saying about this error. To try to confirm that I executed the exact same ant command as NB is using but from the command line; it ran without errors and the app launched on the phone. That’s maybe not a confirmation but it sure is an indication that NB (or one of its plugins) might be causing this.

Ah right. I think @ndebruyn had that Problem as well?

I’m trying the BootMonkey route but I don’t quite understand how it all fits together. Some questions:

  1. Can I use the Android template @aegroto created from within the jME SDK? If so, how do I install it?
  2. Do I somehow need to install BootMonkey explicitly (in the SDK, as a command line tool or somehow accessible by gradle)?

What I have tried so far is to clone the Android Template and run ‘gradle wrapper’. I have no idea if that’s what I’m supposed to do but running ‘gradlew’ directly complained about a missing jar. Googling turned up the wrapper command. After having fixed some Android SDK paths and version numbers it bombs out with the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘JMEAndroidTemplate’.

failed to find Build Tools revision 25.2.5

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

BUILD FAILED

Total time: 0.73 secs

I also tried SDK Tools version 25.3.1 with the same result.

What am I missing or am I doing this completely wrong? Some help appreciated :slight_smile:

Sorry but I did not read the whole thread.
Here is a link to my discussion regarding the same problem.

@ndebruyn Thanks for the link. Did you try out the SDK with NB 8.1?

Hi @jenspall,
Yes I made my own build of the jME SDK using netbeans 8.1.
That solved the problem.

Also I would love if someone can make an official release of the SDK using jME3.1 stable and Netbeans 8.1

:wink:

What happens if you take the master Version (Android: Update NBAndroid Plugin Repo (Note: It says 8.1 but accordin… · jMonkeyEngine/sdk@1882f4b · GitHub) does that fix the cert bug (the targets issue still remains but we have to rewrite anything sdk related there plus maybe an ui rewrite to download new targets)