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

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.

yeah, for example photos access to save screenshotor video ads :wink: would need this - there was example in forum how to use it. Also note if u will upload targetsdk 25 u will not be able to downgrade it in store - sometimes it can raise issue for older devices.

Device/sdk compatibility is a pretty fuzzy issue with Cocos… Do you have reference where it’s mentioned that high/up-to-date targetsdk versions may cause problems with API 15+ devices?

If target sdk is to high it crashing on android 4.x devices(from forum at least a lot such posts was) - from our experience millions of users - best for now was min 15, target 22, ndk-10 then u could have 1-4% of crashes.

And the sdk version that it was compiled against?

compile, target =22
minsdk = 15
inside Application.mk = 15

Maybe compiling against sdk 20 would yield less freezes on 4.x devices. I tried to gather more information about this issue (About breaking compatibility with devices when compiling with Android API >= 21).