From 52154d5f04460aa7ac972f592f84309d243d6e90 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 5 Feb 2018 11:09:29 +0800 Subject: [PATCH 1/3] Best gradle configuration for Android. --- .../android/libcocos2dx-with-controller/build.gradle | 8 ++++---- native/cocos/platform/android/libcocos2dx/build.gradle | 6 +++--- .../runtime-src/proj.android-studio/app/build.gradle | 8 ++++---- .../runtime-src/proj.android-studio/app/build.gradle | 8 ++++---- .../runtime-src/proj.android-studio/app/build.gradle | 8 ++++---- .../runtime-src/proj.android-studio/app/build.gradle | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/native/cocos/platform/android/libcocos2dx-with-controller/build.gradle b/native/cocos/platform/android/libcocos2dx-with-controller/build.gradle index 4fbe7305c1..7e8e2af6f6 100644 --- a/native/cocos/platform/android/libcocos2dx-with-controller/build.gradle +++ b/native/cocos/platform/android/libcocos2dx-with-controller/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 26 + buildToolsVersion "26.0.2" defaultConfig { - minSdkVersion 10 - targetSdkVersion 22 + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" } diff --git a/native/cocos/platform/android/libcocos2dx/build.gradle b/native/cocos/platform/android/libcocos2dx/build.gradle index cb1d217962..2a6baef87c 100644 --- a/native/cocos/platform/android/libcocos2dx/build.gradle +++ b/native/cocos/platform/android/libcocos2dx/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 + compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { - minSdkVersion 10 - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" } diff --git a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle index fc5b4f3112..2d44703228 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -3,13 +3,13 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "org.cocos2dx.hellojavascript" - minSdkVersion 10 - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION + arguments 'APP_PLATFORM=android-14' def module_paths = [project.file("${COCOS_X_ROOT}"), project.file("${COCOS_X_ROOT}/cocos"), diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle index 63c4e2f394..bce578bbfa 100755 --- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -3,13 +3,13 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "org.cocos2d.helloworld" - minSdkVersion 10 - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION + arguments 'APP_PLATFORM=android-14' def module_paths = [project.file("../../../cocos2d-x"), project.file("../../../cocos2d-x/cocos"), diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle index fc5b4f3112..2d44703228 100755 --- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -3,13 +3,13 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "org.cocos2dx.hellojavascript" - minSdkVersion 10 - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION + arguments 'APP_PLATFORM=android-14' def module_paths = [project.file("${COCOS_X_ROOT}"), project.file("${COCOS_X_ROOT}/cocos"), diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle index d5ec30dc85..c9bb6abdc9 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -3,13 +3,13 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "org.cocos2d.helloworld" - minSdkVersion 10 - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion 14 + targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION + arguments 'APP_PLATFORM=android-14' def module_paths = [project.file("../../../../../.."), project.file("../../../../../../cocos"), From 3e5f8dd0f23d5d02fe5531a62cc08af109f2dfa7 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 5 Feb 2018 11:18:13 +0800 Subject: [PATCH 2/3] API Level is minSDKVersion now. --- .../runtime-src/proj.android-studio/app/build.gradle | 4 ++-- .../runtime-src/proj.android-studio/gradle.properties | 2 +- .../runtime-src/proj.android-studio/app/build.gradle | 4 ++-- .../runtime-src/proj.android-studio/gradle.properties | 2 +- .../runtime-src/proj.android-studio/app/build.gradle | 4 ++-- .../runtime-src/proj.android-studio/gradle.properties | 2 +- .../runtime-src/proj.android-studio/app/build.gradle | 4 ++-- .../runtime-src/proj.android-studio/gradle.properties | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle index 2d44703228..ca63ab7e2a 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "org.cocos2dx.hellojavascript" - minSdkVersion 14 + minSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-14' + arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION def module_paths = [project.file("${COCOS_X_ROOT}"), project.file("${COCOS_X_ROOT}/cocos"), diff --git a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/gradle.properties b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/gradle.properties index a3481a69a4..3b03efe9e5 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/gradle.properties +++ b/native/templates/js-template-binary/frameworks/runtime-src/proj.android-studio/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -PROP_TARGET_SDK_VERSION=22 +PROP_TARGET_SDK_VERSION=14 PROP_APP_ABI=armeabi-v7a RELEASE_STORE_FILE= diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle index bce578bbfa..fb8a5bacd8 100755 --- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "org.cocos2d.helloworld" - minSdkVersion 14 + minSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-14' + arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION def module_paths = [project.file("../../../cocos2d-x"), project.file("../../../cocos2d-x/cocos"), diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle.properties b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle.properties index a3481a69a4..3b03efe9e5 100755 --- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle.properties +++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -PROP_TARGET_SDK_VERSION=22 +PROP_TARGET_SDK_VERSION=14 PROP_APP_ABI=armeabi-v7a RELEASE_STORE_FILE= diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle index 2d44703228..ca63ab7e2a 100755 --- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "org.cocos2dx.hellojavascript" - minSdkVersion 14 + minSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-14' + arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION def module_paths = [project.file("${COCOS_X_ROOT}"), project.file("${COCOS_X_ROOT}/cocos"), diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle.properties b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle.properties index a3481a69a4..3b03efe9e5 100755 --- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle.properties +++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -PROP_TARGET_SDK_VERSION=22 +PROP_TARGET_SDK_VERSION=14 PROP_APP_ABI=armeabi-v7a RELEASE_STORE_FILE= diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle index c9bb6abdc9..36df74cedd 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "org.cocos2d.helloworld" - minSdkVersion 14 + minSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -19,7 +19,7 @@ android { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=4.9' - arguments 'APP_PLATFORM=android-14' + arguments 'APP_PLATFORM=android-'+PROP_TARGET_SDK_VERSION def module_paths = [project.file("../../../../../.."), project.file("../../../../../../cocos"), diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties index cc90e06ea7..b85b5f0ba1 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -PROP_TARGET_SDK_VERSION=22 +PROP_TARGET_SDK_VERSION=14 PROP_APP_ABI=armeabi:armeabi-v7a:arm64-v8a:x86 RELEASE_STORE_FILE=debug.keystore From 409d1320b50f79c4b389faadcfb5c84d7e91f333 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 5 Feb 2018 11:20:00 +0800 Subject: [PATCH 3/3] cocos2dx build.gradle fix. --- native/cocos/platform/android/libcocos2dx/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/cocos/platform/android/libcocos2dx/build.gradle b/native/cocos/platform/android/libcocos2dx/build.gradle index 2a6baef87c..65be435199 100644 --- a/native/cocos/platform/android/libcocos2dx/build.gradle +++ b/native/cocos/platform/android/libcocos2dx/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion '26.0.2' defaultConfig { - minSdkVersion 14 + minSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion 26 versionCode 1 versionName "1.0"