I need help, how add third lib in Classes folder?
you want to add c++ or java source code or .jar/.aar?
c++:
- add the .h and .cpp files to your classes folder or anywhere you like but the classes folder is perfect for it.
- add the .cpp file in Android.mk to your LOCAL_SRC_FILES
java: - add the java files to your app/src/ folder within the used package
jar:
- make a libs folder in your app folder and add the jar file to it
- add implementation fileTree(dir: ‘libs’, include: [’*.jar’]) to your gradle file inside dependencies {
aar:
- make a libs folder in your app folder and add the aar file to it
- add implementation fileTree(dir: ‘libs’, include: [’*.aar’]) to your gradle file inside dependencies {
make a gradle sync then.
if you use android studio 2.x you have to use compile instead of implementation
I want to add c++ lib, dragonbones runtime in android studio build.
dragonbones is opensrc, why dont you add the src files?
I don’t know how add them, syntax, i use cocos2d-x 3.17, android studio 3.1.3. In xcode it’s work fine, but for android, i can’t build game
you need to edit Android.mk
, as you mentioned:
LOCAL_SRC_FILES := $(LOCAL_PATH)/hellocpp/main.cpp \
$(LOCAL_PATH)/../../../Classes/AppDelegate.cpp \
$(LOCAL_PATH)/../../../Classes/HelloWorldScene.cpp
just use a text editor.
Yes, I edit this file, i try add dragonbones runtime, i need to add all dragonbones files in Android.mk?
Do you have it as a library or just source files? Can you update the header search path and include paths instead?
I have this like source files, and i can’t create library, i’am trying use Android.mk from dragonBones lib source, they have folder with example, but i can’t setup it’s correct
Can you post a picture of where these classes are in relationship to your Cocos2d-x Classes folder? Perhaps we can look at that and help with path issues.
I put dragonBones runtime in Classes folder, in xcode it works fine, i don’t have errors and problems, but in android studio, i have problems with dragonBones, when clear project building and running very good
Hi. I have same problem. I think Android Studio users need a solution for that problem.
You can add wild cards for the folder(s), might need to have a few for each folder in that setup you have…
Example (Android.mk):
FILE_LIST_CPP := $(wildcard \
$(LOCAL_PATH)/../../../Classes/*.cpp)
FILE_LIST_C := $(wildcard \
$(LOCAL_PATH)/../../../Classes/*.c)
...
LOCAL_SRC_FILES += $(FILE_LIST_CPP:$(LOCAL_PATH)/%=%)
LOCAL_SRC_FILES += $(FILE_LIST_C:$(LOCAL_PATH)/%=%)
In your case would be like ../Classes/dragonBones/*/*.cpp
or one for each sub folder, you might have to try it yourself.