Android Studio - Unsupported major.minor version 52.0?

Android Studio - Unsupported major.minor version 52.0?
0

#1

When trying to compile my project with the command cocos compile -p android --android-studio, I get the following error:
Build file ‘E:\cocos2d-x-3.17\projects\androidt\proj.android\app\build.gradle’ line: 1

* What went wrong:
A problem occurred evaluating project ':androidt'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

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

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Error running command, return code: 1.

Of course, I did check 'E:\cocos2d-x-3.17\projects\androidt\proj.android\app\build.gradle' line: 1 and the line was apply plugin: 'com.android.application'.

I have tried NDK 18 for which cocos2dx does not seem to be up to date for. Then, I went back to 17c, which did not work either. Now I am using 16b and this error occurs. I have graddle set to 3.2.0 in the top-level build.gradle. Why does this error occur and how to fix it?


#2

The message isn’t related to the NDK. It’s your Java SDK which ist the wrong version. Just usw Google to see more about this issue.


#3

I did google it before posting this, of course (do not wish to waste your time on purpose). However, the googling was without any luck… Your post just made me check twice though and I got it working - so thank you :slight_smile: But how can I make a cocos2dx AS project up to date then? To use the latest SDK and NDK without getting all these errors?


#4

Once you are in Android Studio you don’t need to use the cocos command anymore.


#5

It wasn’t angry from me. Sorry, if you had this feeling. I was in my phone and hadn’t time for a fully tutorial. :joy:


#6

Well, just felt it was easier that way at the time being. However, I just tried to create a brand new cocos project and opened it in Android Studio after which I was asked to update the project’s Android Graddle Plugin version from 3.2 to 4.6; I hit “Yes” and then, when I tried to rebuild it, I got these errors as if the update was the cause for these:
Build command failed.
Error while executing process E:\AndroidTools\android-ndk-r17c\ndk-build.cmd with arguments

 {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\cocos2d-x-3.17\projects\androidx\proj.android\app\jni\Android.mk NDK_APPLICATION_MK=E:\cocos2d-x-3.17\projects\androidx\proj.android\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=E:/cocos2d-x-3.17/projects/androidx/proj.android/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\cocos2d-x-3.17\projects\androidx\proj.android\app\build\intermediates\ndkBuild\debug\lib NDK_TOOLCHAIN_VERSION=clang -j12 NDK_DEBUG=1 E:/cocos2d-x-3.17/projects/androidx/proj.android/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libMyGame.so}
[armeabi-v7a] "Compile++ arm  ": "cocostudio_static <= WidgetReader.cpp"
process_begin: CreateProcess(NULL, E:/AndroidTools/android-ndk-r17c/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -MMD -MP -MF E:/cocos2d-x-3.17/projects/androidx/proj.android/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o.d -gcc-toolchain E:/AndroidTools/android-ndk-r17c/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -g -target armv7-none-linux-androideabi14 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -marm -O0 -UNDEBUG -fno-limit-debug-info -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/editor-support/cocostudio/.. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/editor-support/cocostudio/WidgetReader -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/ui/../editor-support -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/audio/android/../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/flatbuffers/.. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/extensions/. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/extensions/.. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/extensions/GUI/CCControlExtension -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/extensions/GUI/CCScrollView -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/audio/android/../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/Box2D/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/Box2D/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/network -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/android-specific/tremolo -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/android-specific/pvmp3dec/src -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/android-specific/pvmp3dec/include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/.. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/tinyxml2 -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/unzip -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/chipmunk/include/chipmunk -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/bullet/include/bullet -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/xxhash -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/nslog -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/poly2tri -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/poly2tri/common -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/poly2tri/sweep -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/../external/clipper -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/websockets/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/freetype2/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/freetype2/prebuilt/android/../../include/android/freetype2 -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/png/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/jpeg/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/tiff/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/webp/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/chipmunk/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/zlib/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/recast/.. -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include/bullet -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/platform/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/openssl/prebuilt/android/../../include/android -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/openssl/prebuilt/android/../../include/android -IE:/AndroidTools/android-ndk-r17c/build//../sources/android/cpufeatures -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/AndroidTools/android-ndk-r17c/build//../sources/cxx-stl/llvm-libc++/include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/AndroidTools/android-ndk-r17c/build//../sources/cxx-stl/llvm-libc++abi/include -IE:/AndroidTools/android-ndk-r17c/build//../sources/android/support/include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/external/bullet/prebuilt/android/../../include -IE:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/editor-support/cocostudio -std=c++11 -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat -DCOCOS2D_DEBUG=1 -DANDROID -DUSE_FILE32API -fexceptions -D__ANDROID_API__=14 -Wa,--noexecstack -Wformat -Werror=format-security -Wno-deprecated-declarations -D__STDC_LIMIT_MACROS=1 -fexceptions --sysroot E:/AndroidTools/android-ndk-r17c/build//../sysroot -isystem E:/AndroidTools/android-ndk-r17c/build//../sysroot/usr/include/arm-linux-androideabi -c E:/cocos2d-x-3.17/projects/androidx/proj.android/app/jni/../../../cocos2d/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp -o E:/cocos2d-x-3.17/projects/androidx/proj.android/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o, ...) failed.
make (e=2): File not found.
make: *** [E:/cocos2d-x-3.17/projects/androidx/proj.android/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o] Error 2
make: *** Waiting for unfinished jobs....

Why?

Regarding the NDK version, when using any version above 17c, I get the error that mips64el-linux-android cannot be found which makes sense since it was removed in version 18. But if I wish to use features from the latest NDK (+ SDK) and thus keeping my project up to date - how can I do that?