cocos_android/app/build.gradle
2023-09-01 16:16:43 +08:00

196 lines
6.9 KiB
Groovy

import org.apache.tools.ant.taskdefs.condition.Os
//apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
// Add the Google services Gradle plugin
id 'com.google.gms.google-services'
// Add the Crashlytics Gradle plugin
id 'com.google.firebase.crashlytics'
}
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
buildToolsVersion PROP_BUILD_TOOLS_VERSION
assetPacks = [":UnityDataAssetPack"] //PAD资源分发
ndkVersion "21.3.6528147"
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
defaultConfig {
applicationId "com.cege.games.release"
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 46
versionName "1.0.46"
ndk{
abiFilters 'armeabi-v7a','arm64-v8a'
}
externalNativeBuild {
ndkBuild {
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
// skip the NDK Build step if PROP_NDK_MODE is none
targets 'cocos2djs'
arguments 'NDK_TOOLCHAIN_VERSION=clang'
def module_paths = [project.file(rootProject.ext.cfgs.cocos2dxBasePath),
project.file(rootProject.ext.cfgs.cocos2dxBasePath+"/cocos"),
project.file(rootProject.ext.cfgs.cocos2dxBasePath+"/external")]
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
}
else {
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
}
arguments '-j' + Runtime.runtime.availableProcessors()
abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
}
}
}
manifestPlaceholders = [
'appAuthRedirectScheme': 'com.googleusercontent.apps.53206975661-asnf3qe4bg29p8h981pgf099osvrjbme'
]
}
sourceSets.main {
java.srcDirs "../src", "src"
res.srcDirs "../res", 'res'
jniLibs.srcDirs "../libs", 'libs'
manifest.srcFile "AndroidManifest.xml"
}
externalNativeBuild {
ndkBuild {
if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
// skip the NDK Build step if PROP_NDK_MODE is none
path "jni/Android.mk"
}
}
}
signingConfigs {
debug {
storeFile file("${rootDir}/keys/release")
storePassword '7654321'
keyAlias 'release'
keyPassword '7654321'
}
release {
storeFile file("${rootDir}/keys/release")
storePassword "7654321"
keyAlias "release"
keyPassword "7654321"
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
firebaseCrashlytics {
// Enable processing and uploading of native symbols to Firebase servers.
// By default, this is disabled to improve build speeds.
// This flag must be enabled to see properly-symbolicated native
// stack traces in the Crashlytics dashboard.
nativeSymbolUploadEnabled true
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude("META-INF/DEPENDENCIES")
exclude("META-INF/LICENSE")
exclude("META-INF/LICENSE.txt")
exclude("META-INF/license.txt")
exclude("META-INF/NOTICE")
exclude("META-INF/NOTICE.txt")
exclude("META-INF/notice.txt")
exclude("META-INF/ASL2.0")
exclude("META-INF/*.kotlin_module")
}
}
android.applicationVariants.all { variant ->
// delete previous files first
delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
variant.mergeAssetsProvider.get().doLast {
def sourceDir = rootProject.ext.cfgs.jsFilePath
copy{
from "${sourceDir}"
include "Data/js/**"
into outputDir
}
copy {
from "${sourceDir}/cert/cacert.pem"
into outputDir
}
}
}
dependencies {
implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation project(':unityLibrary')
implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: ['*.jar'])
implementation fileTree(dir: rootProject.ext.cfgs.cocos2dxBasePath + "/cocos/platform/android/java/libs", include: ['*.jar'])
implementation project(':libcocos2dx')
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.biometric:biometric:1.1.0"
implementation 'com.google.android.gms:play-services-auth:20.3.0'
// implementation 'com.xm.permissions:XmPermissions:1.0.1'
implementation 'pub.devrel:easypermissions:3.0.0'
implementation 'com.github.jenly1314:zxing-lite:2.1.1'
implementation 'net.openid:appauth:0.11.1'
implementation "com.squareup.okio:okio:2.10.0"
implementation 'com.android.volley:volley:1.2.1'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.bytedance.ies.ugc.aweme:opensdk-oversea-external:0.2.1.0'
implementation 'com.google.android.play:core:1.10.0' //PAD资源分发
implementation 'com.facebook.android:facebook-core:latest.release'
implementation 'com.facebook.android:facebook-login:latest.release'
implementation 'com.facebook.android:facebook-share:latest.release'
// begin of firebase
implementation platform('com.google.firebase:firebase-bom:32.1.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ndk'
// end of firebase
// google pay
implementation "com.android.billingclient:billing:6.0.1"
// google drive
implementation('com.google.api-client:google-api-client-android:2.2.0') {
exclude group: 'org.apache.httpcomponents'
exclude module: 'guava-jdk5'
}
implementation 'com.google.http-client:google-http-client-android:1.23.0'
implementation('com.google.apis:google-api-services-drive:v3-rev20230815-2.0.0') {
exclude group: 'org.apache.httpcomponents'
exclude module: 'guava-jdk5'
}
}