@krow i updated Android Studio to 2.3, can not see cocos2d-x c++ source code too. Can you see it?
No, I can only see cocos2d-x Java source code.
The only time I see cocos2d-x c++ source code is if I step into it with the debugger.
Yep, i met the issue.
Strange, can you upload example project, where you can’t see cpp files?
You can just use cocos2d-x v3 branch, and use Android Studio to open tests/cpp-empty-test/proj.android-studio
folder.
I’ve updated compileSdkVersion to 25, buildToolsVersion to 25.0.1, gradle version to 2.3.0. I don’t get this “PROP_NDK_NODE” stuff so I’ve removed all if’s in gradle file. Now I can see all cpp files:
Here’s the cpp-empty-test project:
proj.android-studio.zip (148.6 KB)
@piotrros after updating gradle and build tools version, i can see the cpp files now. It is nothing about the ifs
. Thanks.
But to what value PROP_NDK_MODE should be set?
cocos command will pass parameters to gradle build system to make it compatible as before.
But I’m launching project directly from Android Studio. So I don’t really use cocos command a lot.
No problem, the value is defined in gradle.properties. If using Android Studio, the value comes from gradle.properties, if using cocos command, it comes from cocos command.
I don’t see PROP_NDK_MODE here, what are possible values of this?
PROP_TARGET_SDK_VERSION is the target version. PROP_APP_ABI is the ABI setting. I think the file has detail information. Use these variables is because cocos command need to support Android Studio projects too.
Hi @zhangxm
I’m trying to run cpp-tests in v3 branch but when i run the project in android studio i get the following error , i’m building with android studio 2.3 and ndk-r13b :
Build command failed.
Error while executing process E:\android-ndk-r13b\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-9 NDK_OUT=C:/cocos2d-x/tests/cpp-tests/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-13 NDK_MODULE_PATH=../../../..:../../../../cocos:../../../../external -j8 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING: Ignoring unknown import directory: ../../../..:../../../../cocos:../../../../external
Android NDK: C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Android.mk: Cannot find module with tag 'cocos' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
process_begin: CreateProcess(NULL, "", ...) failed.
Build command failed.
Error while executing process E:\android-ndk-r13b\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-9 NDK_OUT=C:/cocos2d-x/tests/cpp-tests/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\build\intermediates\ndkBuild\debug\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-13 NDK_MODULE_PATH=../../../..:../../../../cocos:../../../../external -j8 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
Android NDK: WARNING: Ignoring unknown import directory: ../../../..:../../../../cocos:../../../../external
Android NDK: C:\cocos2d-x\tests\cpp-tests\proj.android-studio\app\jni\Android.mk: Cannot find module with tag 'cocos' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
process_begin: CreateProcess(NULL, "", ...) failed.
can you help me here please?
I haven’t tested on windows. It seems the path separator is error, how about change the contents of tests/cpp-tests/proj.android-studio/app/build.gradle
from
arguments 'NDK_MODULE_PATH=../../../..:../../../../cocos:../../../../external'
to
arguments 'NDK_MODULE_PATH=../../../..;../../../../cocos;../../../../external'
then try again.
Are the changes for Android Studio already in 3.14-1 from cocos2d-x.org? Or only on github?
I tried to open cpp-tests, cpp-empty-tests and one HelloWorld project but I don’t see the c++ files anywhere.
I think it is only in repository - 3.14.1 was released without such functionality.
Yep, it is in github repo. Will be included in next version.
Glad to hear that. I will check if it works in Mac after this modification.