From 4a991bd64272743d6e02896f1360c4ebac430525 Mon Sep 17 00:00:00 2001
From: 2youyouo2 <501251991@qq.com>
Date: Thu, 26 May 2016 18:42:54 +0800
Subject: [PATCH 1/2] update android-studio templates
---
.../cocos-project-template.json | 1 +
.../app/AndroidManifest.xml | 12 +++++------
.../proj.android-studio/app/build.gradle | 20 +++++++++++++++++++
.../proj.android-studio/app/jni/Android.mk | 8 +++++---
.../proj.android-studio/build.gradle | 2 +-
.../gradle/wrapper/gradle-wrapper.properties | 2 +-
.../cocos-project-template.json | 1 +
.../app/AndroidManifest.xml | 12 +++++------
.../proj.android-studio/app/build.gradle | 20 +++++++++++++++++++
.../proj.android-studio/app/jni/Android.mk | 8 +++++---
.../proj.android-studio/build-cfg.json | 16 ++++++++-------
.../proj.android-studio/build.gradle | 2 +-
.../gradle/wrapper/gradle-wrapper.properties | 2 +-
.../proj.android-studio/settings.gradle | 2 +-
14 files changed, 78 insertions(+), 30 deletions(-)
diff --git a/native/templates/js-template-default/cocos-project-template.json b/native/templates/js-template-default/cocos-project-template.json
index c2a11dc87c..5c06dcdb33 100755
--- a/native/templates/js-template-default/cocos-project-template.json
+++ b/native/templates/js-template-default/cocos-project-template.json
@@ -46,6 +46,7 @@
"frameworks/runtime-src/proj.android/build.xml",
"frameworks/runtime-src/proj.android/res/values/strings.xml",
"frameworks/runtime-src/proj.android-studio/settings.gradle",
+ "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml",
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj",
diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
index 59cb2ffb84..447d63d2f3 100755
--- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
+++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
@@ -10,9 +10,9 @@
android:icon="@mipmap/ic_launcher">
-
-
+
+
-
-
+
+
-
+
\ No newline at end of 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 ba1a05574f..aca8a09a89 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
@@ -47,3 +47,23 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
}
+
+
+task cleanAssets(type: Delete) {
+ delete 'assets'
+}
+task copyAssets(type: Copy) {
+ from('../../../cocos2d-x/cocos/scripting/js-bindings/') {
+ include 'script/**'
+ }
+ from('../../../../') {
+ include 'res/**'
+ include 'src/**'
+ include 'main.js'
+ include 'project.json'
+ }
+ into 'assets'
+}
+
+clean.dependsOn cleanAssets
+preBuild.dependsOn copyAssets
\ No newline at end of file
diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
index 26a744cd2c..d53d0b7fdb 100755
--- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
+++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
@@ -6,10 +6,12 @@ LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
+ifeq ($(USE_ARM_MODE),1)
+LOCAL_ARM_MODE := arm
+endif
+
LOCAL_SRC_FILES := hellojavascript/main.cpp \
- ../../../Classes/AppDelegate.cpp \
- ../../../Classes/CCScale9Sprite.cpp \
- ../../../Classes/jsb/jsb_creator_auto.cpp
+ ../../../Classes/AppDelegate.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/build.gradle b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/build.gradle
index 9405f3fd18..1b7886d148 100755
--- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/build.gradle
+++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
index 0c71e760dc..e7faee01a4 100755
--- a/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
+++ b/native/templates/js-template-default/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
diff --git a/native/templates/js-template-link/cocos-project-template.json b/native/templates/js-template-link/cocos-project-template.json
index 6b6b7fc694..def50e1629 100755
--- a/native/templates/js-template-link/cocos-project-template.json
+++ b/native/templates/js-template-link/cocos-project-template.json
@@ -51,6 +51,7 @@
"frameworks/runtime-src/proj.android/build.xml",
"frameworks/runtime-src/proj.android/res/values/strings.xml",
"frameworks/runtime-src/proj.android-studio/settings.gradle",
+ "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml",
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj",
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
index 59cb2ffb84..447d63d2f3 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/AndroidManifest.xml
@@ -10,9 +10,9 @@
android:icon="@mipmap/ic_launcher">
-
-
+
+
-
-
+
+
-
+
\ No newline at end of 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 ba1a05574f..00e1f39bff 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
@@ -47,3 +47,23 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
}
+
+
+task cleanAssets(type: Delete) {
+ delete 'assets'
+}
+task copyAssets(type: Copy) {
+ from('${COCOS_X_ROOT}/cocos/scripting/js-bindings/') {
+ include 'script/**'
+ }
+ from('../../../../') {
+ include 'res/**'
+ include 'src/**'
+ include 'main.js'
+ include 'project.json'
+ }
+ into 'assets'
+}
+
+clean.dependsOn cleanAssets
+preBuild.dependsOn copyAssets
\ No newline at end of file
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
index 26a744cd2c..d53d0b7fdb 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk
@@ -6,10 +6,12 @@ LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
+ifeq ($(USE_ARM_MODE),1)
+LOCAL_ARM_MODE := arm
+endif
+
LOCAL_SRC_FILES := hellojavascript/main.cpp \
- ../../../Classes/AppDelegate.cpp \
- ../../../Classes/CCScale9Sprite.cpp \
- ../../../Classes/jsb/jsb_creator_auto.cpp
+ ../../../Classes/AppDelegate.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build-cfg.json b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build-cfg.json
index d427ea47b6..5a884a4368 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build-cfg.json
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build-cfg.json
@@ -1,8 +1,10 @@
{
"ndk_module_path" :[
- "../../cocos2d-x",
- "../../cocos2d-x/cocos",
- "../../cocos2d-x/external"
+ "${COCOS_X_ROOT}",
+ "${COCOS_X_ROOT}/cocos",
+ "${COCOS_X_ROOT}/external",
+ "${COCOS_X_ROOT}/external/android/include",
+ "${COCOS_X_ROOT}/external/android/spidermonkey"
],
"copy_resources": [
{
@@ -18,12 +20,12 @@
"to": ""
},
{
- "from": "../../../project.json",
- "to": ""
+ "from": "${COCOS_X_ROOT}/cocos/scripting/js-bindings/script",
+ "to": "script"
},
{
- "from": "../../cocos2d-x/cocos/scripting/js-bindings/script",
- "to": "script"
+ "from": "../../../project.json",
+ "to": ""
}
]
}
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build.gradle b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build.gradle
index 9405f3fd18..1b7886d148 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build.gradle
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
index 0c71e760dc..e7faee01a4 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/settings.gradle b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/settings.gradle
index 133ec2d702..52bd19dfee 100755
--- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/settings.gradle
+++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/settings.gradle
@@ -1,4 +1,4 @@
include ':libcocos2dx'
-project(':libcocos2dx').projectDir = new File(settingsDir, '../../cocos2d-x/cocos/platform/android/libcocos2dx')
+project(':libcocos2dx').projectDir = new File('${COCOS_X_ROOT}/cocos/platform/android/libcocos2dx')
include ':HelloJavascript'
project(':HelloJavascript').projectDir = new File(settingsDir, 'app')
From d45928a6551b53116ecd67862a7bf1064a95a478 Mon Sep 17 00:00:00 2001
From: 2youyouo2 <501251991@qq.com>
Date: Wed, 1 Jun 2016 17:40:12 +0800
Subject: [PATCH 2/2] reset build.gradle
---
.../proj.android-studio/app/build.gradle | 20 -------------------
.../proj.android-studio/app/build.gradle | 20 -------------------
2 files changed, 40 deletions(-)
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 aca8a09a89..ba1a05574f 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
@@ -47,23 +47,3 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
}
-
-
-task cleanAssets(type: Delete) {
- delete 'assets'
-}
-task copyAssets(type: Copy) {
- from('../../../cocos2d-x/cocos/scripting/js-bindings/') {
- include 'script/**'
- }
- from('../../../../') {
- include 'res/**'
- include 'src/**'
- include 'main.js'
- include 'project.json'
- }
- into 'assets'
-}
-
-clean.dependsOn cleanAssets
-preBuild.dependsOn copyAssets
\ No newline at end of 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 00e1f39bff..ba1a05574f 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
@@ -47,23 +47,3 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
}
-
-
-task cleanAssets(type: Delete) {
- delete 'assets'
-}
-task copyAssets(type: Copy) {
- from('${COCOS_X_ROOT}/cocos/scripting/js-bindings/') {
- include 'script/**'
- }
- from('../../../../') {
- include 'res/**'
- include 'src/**'
- include 'main.js'
- include 'project.json'
- }
- into 'assets'
-}
-
-clean.dependsOn cleanAssets
-preBuild.dependsOn copyAssets
\ No newline at end of file