Android studio with prebuilt

Hi, i have problem when compile in android. android studio version : 3.0.1 , using latest cocos2dx version. i followed instruction in this link .
im using prebuilt binary, when i trying to compile, i got this error:



im noob in android environtment. i dont know what to do. please help me. Thanks.

I would just use the normal source code for now. Prebuilts are very difficult to use for Android development currently.

It should be new File('/Applications/cocos2d-x-3.16/cocos/platform/android/libcocos2dx')

true, but do you feel the prebuilts are quite difficult to use in Android projects? There are always so many questions about this.

ah thanks but i got ndk error like :


i think i have to change ndk version ?

are there any users try it out and success with prebuilt ?

Me but for old versions… current;y I’m with 3.16 last stable release…

slackmoehrle thinks its hard because don;t understand how to do it at all. That just fact. Opposite of this - he created a full detailed info. They need developers like - Switch Android APP_STL default to c++_static and https://github.com/cocos2d/cocos2d-x/pull/18470 who well know android and can do prebuilts without problems.
ALso, I found other cocos2d-x devs - https://github.com/Senspark/cocos2d-x-lite who managed to easy build prebuilts for all platforms easily. So ofc if many users ask here and post here but even cocos2d-x devs don;t understand what to do and how - they will think that it’s hard. Just need experience, really. It’s me don’t understand many things about prebuilt.

I’ve already told to cocos2d-x developers - they should push prebuilt libs as fist option to work with cocos2d-x. Same as here https://github.com/Senspark/cocos2d-x-lite and next options is use source code, optional even.

Wow, is that what you think? Please don’t ask me for any favors in the future. Seriously.

It isn’t just about switching settings, it is about all the variations that have to be done to target multiple cocos2d-x versions and multiple devices. Its that simple. I suggest source because that gets the developer started while the shake out their plan. Source will always work if cocos2d-x changes or Android SDK changes or hardware changes, etc. Developer can simply re-compile and not worry about several combinations to run on most all devices/os versions.

1 Like

That’s the correct reaction. Kudos for that.

Beside from that, I don’t wanted the rebuilt libs of external libraries, but this will never happened. So I can’t use 100% source code for my projects. That would be really nice to have full control of everything. I don’t have any issues with compile times. Okay, the first one is large, but after that, if I don’t change branches or change core code, it will only compile changed files.

1 Like

what setting do i have to change if use normal source code ? i just installed android studio and installed the requirement and open android-studio folder, the result of compiled is still give error about ndk. im sorry for keep asking basic stuff, i really have no exp in android environtment.

I would review this thread: Switch Android APP_STL default to c++_static It has so much information.

thanks a lot @slackmoehrle are u planning to update the result from ur review to this doc link ? the documentation seems good and structured now.
im sure it will help cocos2d-x user who want to compile to android like me since compile command is deprecated. for prebuilt, i’ll look forward for official how-to in documentation or forum.

Yes, I have this task on my list. I will make it a higher priority.

anyway, APP_ABI armeabi is deprecated in ndk16, should i write all instead armeabi?

cocos2d of android can only support armeabi-v7a, arm64-v8a and x86 for the most part (at least that i all I would to support)

I am gonna work on a PR to help update prebuilt for Andorid for 3.17 hopefully

2 Likes

So i an into an immediate problem with cocos console and alot of the hidden android project haven’t been updated to use gradle.

On top of that, The python code for cocos console isn’t the best thing to look at right now.

There is alot of things happening here that we probably don’t need.

@slackmoehrle Here is the golden question that will help solve a lot of these issues. Is it in the roadmap to completely remove old android projects using ant for future engine version? at this point, I don’t think they are needed, especially since most of the templates are not on Build tool 27.0.1 and Ant was deprecated way back in 25.3.x

Yes, Android command-line, Eclipse and Visual Studio are all now deprecated and Android Studio is the preferred way to develop. We will no longer create proj.android, etc. Moving to CLANG to build everything. This also means dropping some architectures too, iiuc.

Nice. I think once that clean up happens, it’ll be easier to do.

Based off of what I see, I think all we would need to do is build with gradle once, then update Android.mk to check for prebuilt libraries to use for linking instead of building from source if we wanted to

1 Like

@zhangxm is on top of this process. He will definitely do everything needed to smooth out this experience. We appreciate the threads you have made helping provide direction on this.

No problem. Anything I can do you help just message me! I’m a self-proclaimed Android Enthusiast / Advocate lol