SDK Implementation - fan-ADN/nendSDK-cocos2d-x GitHub Wiki
Follow nendSDK iOS Set Up Manual
- Add
NendAd.embeddedframeworkfolder inNendModule/NendSDK/iOSto Xcode's Project Navigator by drag & drop. - Add the following framework to the project
- AdSupport
- Security
- ImageIO
- AVFoundation
- CoreMedia
- SystemConfiguration
- WebKit
- Optionally add the following framework and enable more detailed information for ad delivery.
- CoreLocation
- CoreMotion
- CoreTelephony

Add NendModule/Common and NendModule/iOS file to the project.

- Add the below code into your
build.grade.
...
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
-
Select
Import .JAR/.AAR PackagefromFile > New > New Module...in the menu tab.
-
Select the
aarfile inNendModule/NendSDK/Android. The name given toSubproject name:will be the name of thebuild.gradlefile,settings.gradlefile, ornendSDKused in the procedure in3..
-
Select
Project name of your appfromFile > Project Structure > Dependencies > Modulesand selectnendSDKimported with3 Module Dependencyfrom2.in the+menu.
-
If
nendSDKadded to3.inbuild.gradlehas been added ascompile project, the embed of theaarfile is complete. Also add following libraries to the project.
- Ultimately the installation of
nendSDKis complete as follows.
build.gradle
android {
compileSdkVersion 28
...
}
...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':libcocos2dx')
implementation ('com.google.android.gms:play-services-ads-identifier:17.0.0') {
exclude module: 'support-v4'
}
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(path: ':nendSDK-5.2.0')
}
If you cannot use AndroidX, Use nendSDK cocos2d-x module version 2.4.0 and set as follows.
Cannot use AndroidX
build.gradle
android {
compileSdkVersion 28
...
}
...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':libcocos2dx')
implementation('com.google.android.gms:play-services-ads-identifier:16.0.0') {
exclude module: 'support-v4'
}
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation project(':nendSDK-5.1.0')
}
- When location data is used in the application Can use location data in ads distribution by adding the following library to dependencies in build.gradle.
dependencies {
...
implementation 'com.google.android.gms:play-services-location:17.0.0'
}
- Run Gradle
Create net.nend.NendModule package as a project and add java source file which is in the NendModule/javaPackage.
※ Build will be done correctly even if the error comes up so please ignore the error alert.

Add file of Nend module (NendModule/Common and NendModule/Android) into the project Classes folder.

The procedure differs depending on the setting of PROP_BUILD_TYPE in gradle.properties.
cmake
Open up your CMakeLists.txt in the project root directory and add the shown lines in below.
...
if(ANDROID)
...
# Add the source file to `GAME_SOURCE`.
file(GLOB_RECURSE NEND_MODULE_SOURCE RELATIVE ${CMAKE_SOURCE_DIR} CONFIGURE_DEPENDS "Classes/Common/*.cpp" "Classes/Android/*.cpp")
list(APPEND GAME_SOURCE ${NEND_MODULE_SOURCE})
# Add the header file to` GAME_HEADER`.
file(GLOB_RECURSE NEND_MODULE_HEADER RELATIVE ${CMAKE_SOURCE_DIR} CONFIGURE_DEPENDS "Classes/Common/*.h" "Classes/Android/*.h")
list(APPEND GAME_HEADER ${NEND_MODULE_HEADER})
...
endif()
...
target_include_directories(${APP_NAME}
...
# Add the paths of NendModule's `Common` and` Android` directories.
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Classes/Common/
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Classes/Android/
)
...ndk-build
Add following code to LOCAL_SRC_FILE of jni/Android.mk.
../../../Classes/Common/NendNativeLabel.cpp \
../../../Classes/Common/NendNativeSprite.cpp \
../../../Classes/Common/NendNativeClippingNode.cpp \
../../../Classes/Common/NendNativeAdClient.cpp \
../../../Classes/Common/NendHttpHelper.cpp \
../../../Classes/Common/NendNativeAdLog.cpp \
../../../Classes/Common/NendNativeAdRender.cpp \
../../../Classes/Common/NendNativeAdBinder.cpp \
../../../Classes/Common/NendNativeAd.cpp \
../../../Classes/Common/NendLogger.cpp \
../../../Classes/Common/NendNativeImpressionTracker.cpp \
../../../Classes/Common/NendVideoAd.cpp \
../../../Classes/Android/NendModule.cpp \
../../../Classes/Android/NendIconModule.cpp \
../../../Classes/Android/NendInterstitialModule.cpp \
../../../Classes/Android/AndroidNativeAd.cpp \
../../../Classes/Android/AndroidNativeJNI.cpp \
../../../Classes/Android/AndroidNativeAdClient.cpp \
../../../Classes/Android/NendFullBoardAd.cpp \
../../../Classes/Android/NendAdJniUtils.cpp \
../../../Classes/Android/NendInterstitialVideoAd.cpp \
../../../Classes/Android/NendRewardedVideoAd.cpp \
../../../Classes/Android/NendUserFeature.cpp \
../../../Classes/Android/AndroidNendLogger.cpp
Add following code to LOCAL_C_INCLUDES of jni/Android.mk.
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/Common
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../Classes/Android