After a few days of learning I now have my app running on Android. There are a number of problems and I would like to be able to set breakpoints in Android Studio and trace through the code.
If I run:
cocos run -p android --android-studio -m debug
It seems to work and the app starts running. I can see this in the log:
How do I set breakpoints ? If I load one of the cpp files and set a breakpoints somewhere on it in Android Studio nothing stops? Sorry to be so dumb but I am very new to Android and the NDK.
Doesn’t for me… once I have prebuilt the compile fails. It’s to do with sdkbox facebook plugin. It compiles and runs OK without prebuilt but then won’t debug.
Only issue I had why debug not worked in Android-Studio - like breakpoint didnt stoped because I missed this part:
Run->Edit configuration - select your project → go to tab debugger → set debuger type hybrid and select proper project symbol directory, it will be under this path
If you will use Android-Studio DEBUG you will not be able to compile project with console-> compile from Android Studio. I’m afraid as you still new to this it will be cahllenge for you to edit gradle;)
Also you would need abiFilters: aremabi if compiling c++ for armeabi
So gradle does not complain, the compile on the command line and in Android Studio works. I can start the debugger from within Android Studio but if I put a break point so on the line
auto scene = HelloWorld::createScene();
Then press the debug button the app will install but it does not stop in the debugger???
If armeabi-v7a try to set in Application.mk APP_ABI:= armeabi-v7a and then change in gradle setup for armeabi-v7a, run and after change that debug path to armeabi-v7a
I am now getting an error about the prebuilt being missing:
Android NDK: Check that /Users/katie/Documents/katiej/cocos2d-x-3.14/cocos/./prebuilt-mk/..\..\prebuilt\android/armeabi-v7a/libcocos2dxinternal.a exists or that its path is correct
So I need to know how to prebuild for armeabi-v7a?
you can google your device cpu , but have u changed .mk file to compile for v7? and changed gradle? like there is many places where u can make misstake so better paster your Application.mk build.gradle and device model.
When I sync gradle it’s giving an error saying indicating that the pre-built does not exist:
Android NDK: Check that /Users/katie/Documents/katiej/cocos2d-x-3.14/cocos/./prebuilt-mk/..\..\prebuilt\android/armeabi-v7a/libcocos2dxinternal.a exists or that its path is correct
When I look in C:\Users\katie\Documents\katiej\cocos2d-x-3.14\prebuilt\android
LuaJavaBridge.cpp:2:108: fatal error: scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h: No such file or directory
#include "scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h"
Lua binding? That’s rather strange error. Did you modified cocos2d-x code? By the way I simply use gen-libs like this:
cocos gen-libs -p android --app-abi armeabi-v7a
If you’ll use both armeabi and armeabi-v7a you’ll double .a library size. I dropped armeabi, because these’re really old devices and I support apps for android 4.0+ (facebook min sdk level for example) .
@katiej, followed your struggles here with interest. Sorry to ask directly, I have managed to get my project to compile and debug in Android Studio but I cannot ‘see’ my C++ source code whatever I seem to try.