Hi,
I’m having a problem with two of my existing projects. When I import Chartboost and IAP Android Studio (3.4.2) complains that #include “PluginChartboost/PluginChartboost.h” and #include “PluginIAP/PluginIAP.h” cannot be found. Also, the SDKBOX_ENABLED macro doesn’t appear to work.
If I put the absolute path to the .h files, it works fine.
I created an empty project and that worked fine, but my two existing projects don’t work.
I am using Cocos2D-X 3.17. 2. Both of the projects were originally created with v3.8, but I have upgraded them by creating a new project and just moving my .cpp files across, so everything else should be 3.17.2.
My CMakeList.txt contains:
# PluginIAP
if(ANDROID)
add_definitions(-DSDKBOX_ENABLED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginIAP/)
target_link_libraries(${APP_NAME} ext_PluginIAP)
endif()
# PluginChartboost
if(ANDROID)
add_definitions(-DSDKBOX_ENABLED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginChartboost/)
target_link_libraries(${APP_NAME} ext_PluginChartboost)
endif()
# sdkbox
if(ANDROID)
add_definitions(-DSDKBOX_ENABLED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/sdkbox/)
target_link_libraries(${APP_NAME} ext_sdkbox)
endif()
My Android.mk contains:
LOCAL_CPPFLAGS := -DSDKBOX_ENABLED
LOCAL_LDLIBS := -landroid \
-llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := PluginChartboost \
sdkbox \
PluginIAP
include $(BUILD_SHARED_LIBRARY)
$(call import-add-path, $(LOCAL_PATH))
$(call import-module, cocos)
$(call import-module, ./sdkbox)
$(call import-module, ./PluginChartboost)
$(call import-module, ./PluginIAP)
Any ideas how I can get Android Studio to recognize my SDKBOX_ENABLED macro and locate the .h files?
Thank you!
I’m not too sure, but I’ll throw in my two cents.
Have you check that the files actually exist at proj.android/app/jni/sdkbox/ and proj.android/app/jni/PluginChartboost/ etc?
Can you be sure SDKBOX_ENABLED isn’t defined?
You could try
:-
#ifdef SDKBOX_ENABLED
#pragma message “SDKBOX is enbabled”
#else
#pragma message “SDKBOX is NOT enabled”
#endif
somewhere in your code and the compiler will spit out either message, just to confirm/deny this.
do u mean empty project with SDKBox plugin works ?
I have some more information about that.
If I create a new Cocos2D-X 3.17.2 project then do “sdkbox import chartboost”, then open it in Android Studio it works.
If I create a new project, open and build the project in Android Studio, close Androd Studio, then do “sdkbox import chartboost” and open Android Studio again, I get the messages saying Android Studio can’t locate the files and the SDKBOX_ENABLE macro doesn’t work.
I’ve tried cleaning the project, refreshing C++ sources and rebuilding the project and none of it works unless I put the full path of the .h file, such as D:/Projects/Game1/proj.android/app/jni/PluginChartboost/PluginChartboost.h.
If it makes any difference, I’m using Android Studio on Windows 10. I’m not very familiar with Android Studio, so maybe there’s something else I need to do to refresh the project and get it to reload the CMakeList and Android.mk files?
macOS 10.13.6
Android Studio 3.2.1
sdkbox 2.5.0.1
- empty 3.17.2
- compile with Studio
- not close studio, run sdkbox import review
- some modify code
bool AppDelegate::applicationDidFinishLaunching() {
sdkbox::PluginReview::init(); // no SDKBOX_ENABLED here
- compile with studio again, I can see studio compile the whole project again.
[1/724] Building…
BUILD SUCCESSFUL in 4m 22s
69 actionable tasks: 36 executed, 33 up-to-date
#ifdef SDKBOX_ENABLED
#pragma message “SDKBOX is enbabled”
#else
#pragma message “SDKBOX is NOT enabled”
#endif
whats the code output?
I get “SDKBOX is NOT enabled” when I use that.