Open solodon4 opened 4 years ago
ndk can find #include <XXXX/XXXX.h>
tabke a look at https://github.com/sdkbox/sdkbox-sample-cpp317/tree/iap
, we didn't include proj.android/app/jni
in .mk file
Hmm, you are right: the sample builds indeed, i only get a warning:
/Classes/HelloWorldScene.cpp:28:10: warning: non-portable path to file '"pluginadmob/PluginAdMob.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "PluginAdMob/PluginAdMob.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
"pluginadmob/PluginAdMob.h"
I wonder what's different with my case and why it doesn't work for me.
OK, the fact it works in sample's case is somehow related to the fact that your plugins are inside JNI folder, I guess that folder is added to search elsewhere. If i create a folder external in the root of the project (i.e. sdkbox-sample-cpp317/external) and move plugins there with correspondent modification in Android.mk:
$(call import-module, ./../../../external/sdkbox)
$(call import-module, ./../../../external/pluginsdkboxads)
$(call import-module, ./../../../external/pluginadmob)
I get the same error in your sample as I get in my own code:
sdkbox-sample-cpp317/proj.android/app/jni/../../../Classes/HelloWorldScene.cpp:28:10: fatal error: 'PluginAdMob/PluginAdMob.h' file not found
#include "PluginAdMob/PluginAdMob.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
you can add sdkbox-sample-cpp317/external
to INCLUDES
in proj.android/app/jni/Android.mk
That wouldn't quite work as I extract all SDKBOX plugins there: external/sdkbox-XXXX
the way they are packed in your sdkbox-XXXX_v2.5.1.2.tar.gz
. With that, for each plugin I have to add external/sdkbox-XXXX/plugin/android/jni
to INCLUDES, which would have been unnecessary if only you guys also exported parent directory from your Android.mk for each SDKBOX plugin.
you should copy sdkbox-XXXX/plugin/android/jni
to external/sdkbox
, and include external/sdkbox
in proj.android/app/jni/Android.mk
.
I understand how I can fix this on my side, i'm just suggesting a trivial improvement on SDKBOX' side for your users. I don't want to move subfolders around too much to avoid subtle differences on my own machine vs CI/CD runners. I simply unpack your plugins and point my Xcode project to iOS frameworks in your folder and my Android project to your Android ones.
If you look at any of your plugins
sdkbox-XXXX_v2.5.1.2.tar.gz
and then look at extractedsdkbox-XXXX_v2.5.1.2/plugin/android/jni/PluginGoogleAnalytics/Android.mk
you will see that all of them only export the same directory as Android.mk:The header file is indeed in that directory, however, all of your source files and respectively sources of all your users include those header files as
#include <XXXX/XXXX.h>
(primarily because they also have to work with frameworks on iOS) so thatLOCAL_EXPORT_C_INCLUDES
is of no use for me. This means that besides the usual:I also have to manually do:
for the parent directory just to make those
#include
directives work.Can you guys also export the parent directory from your plugins so that I don't have to list that directory manually in my source? If that is not possible for some unknown to me reason, can you restructure your plugin's folder in such a way where Android.mk is able to export both folders. Thank you!