Ant (Eclipse project) is not supported from Android SDK Tools 25.3.0

How can I solve this problem:

cocos compile -p android
Python 2.7.10
Building mode: debug
Using Eclipse project : /PROJECTS/COCOS/test/proj.android
Ant (Eclipse project) is not supported from Android SDK Tools 25.3.0.

My configuration is:

macOS Sierra 10.12.5
java version “1.8.0_131”
cocos2d-x-3.15.1
android-ndk-r14b
android studio 2.3.2

I readed old post that suggest to downgrade android-sdk but I can’t found old SDK for Mac. Can you help me to compile or downgrade SDK.

I uploaded the tools folder: https://share.weiyun.com/a56bd766ef612243a2967f99f7be3a51. You just need to replace the folder in Android SDK. The link will be invalid in 7days.

Are there plans to solve this issue?
Are there best practices to cocos2d-x android development on MacOSX?

forget ant , start using android-studio and gradle. Ant really not making sense for cocos 3.x :slight_smile: no any advantage over gradle.

Yep, we suggesting to use Android Studio instead.

1 Like

I’ve tried different sdk versions because of ant. I think cocos needs better documentation. The existing tutorials are outdated and i lost a day before finding this thread.

2 Likes

How to build prebuilt libs with gradle?

Same problem here.

Cocos docs need to be updating.

How to start a new cocos2dx project within Android Studio ?
Like @piotrros asked, how to build prebuilt libs with gradle ?

Does it mean proj.android would not be supported since SDK Tools 25.3.0?

Yep, since some tools removed by Android SDK. Of course you can copy tools from older Android SDK version if you really like ant building.

But will it regain support? Recently I updated with new SDKManager embedded in Android-Studio and even with downgrading to Android SDK tools revision 25.2.3 or 25.2.3 I get this error during compilation:

   [dx] java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
   [dx]     at java.lang.ClassLoader.defineClass1(Native Method)
   [dx]     at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
   [dx]     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
   [dx]     at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
   [dx]     at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
   [dx]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
   [dx]     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   [dx]     at java.security.AccessController.doPrivileged(Native Method)
   [dx]     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   [dx]     at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
   [dx]     at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
   [dx]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   [dx]     at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
   [dx]     at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
   [dx] Exception in thread "main"
BUILD FAILED

Even when building with --ap android-20.

@MatrixAndrew i don’t quite understand your issue. Will you please describe your issue in more detail?

mm

Unsupported major.minor version 52.0

I think it is related to installed on machine Java version so you need newest java

Exactly; buildToolsVersion larger than 23.0.3 requires JDK8, I now successfully use the latest (26.0.0). Also, for me NDK r13b is the highest version that seems to work with Ant projects (proj.android). Plus, the hack of downgrading to platform tools version r25.2.5 is mandatory as well for successful compilation as of now.

I would recomend to intsall/configure on machine cocos2d-x 3.15 and then with it you should be able to compile your ant project event with latest android sdk, I preferring to use NDK 10 it seems have less crashes nad buildtools 25.0.0 , targetsdk 22, minsdk 15

I think this gives better results:
NDK r13b, latest build tools (26.0.0), min sdk 15, target sdk 25, compile sdk 20 (for highest compatibility, not entirely sure though) and platform tools 25.2.5 (with the downgrade hack).

Are u implementing permissions requests on fly because using target sdk 25?

I overlooked, I use targetSdkVersion 23.

permission requests should be implemented starting from target sdk 23 :slight_smile: anyway

1 Like

During debugging it isn’t needed, I’m not planning on using dangerous permissions anyways. It shouldn’t be hard to implement on-the-fly permissions though.