Skip to content

Instantly share code, notes, and snippets.

@akk0rd87
Created August 15, 2021 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akk0rd87/d3838a1f43ef956d3b052ee33bc1cc26 to your computer and use it in GitHub Desktop.
Save akk0rd87/d3838a1f43ef956d3b052ee33bc1cc26 to your computer and use it in GitHub Desktop.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: "com.github.triplet.play"
def akkord_sdk_path = System.getenv('AKKORD_SDK_HOME')
def proGuardParamsDir = System.getenv('AKKORD_SDK_HOME') + "/framework/core/platformwrapper/android/proguard/"
def keystoreFile = System.getenv('ANDROID_KEYSTORE_HOME') + "/keystore_2015.keystore"
def keystoreParamsFile = System.getenv('ANDROID_KEYSTORE_HOME') + "/keystore_2015.params"
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystoreParamsFile))
android {
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreFile)
storePassword keystoreProperties['storePassword']
}
}
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion = 16
targetSdkVersion = 30
versionName new Date().format('yyyyMMddHHmmss')
}
externalNativeBuild {
ndkBuild {
// Tells Gradle to find the root ndk-build script in the same
// directory as the module's build.gradle file. Gradle requires this
// build script to add your ndk-build project as a build dependency and
// pull your native sources into your Android project.
buildStagingDirectory "../main/lib"
path "../main/Android.mk"
//cppFlags.addAll(["-std=c++11"])
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
manifest.srcFile '../AndroidManifest.xml'
java.srcDir "${akkord_sdk_path}/libraries/SDL/SDL/android-project/app/src/main/java/org/libsdl/app/"
java.srcDir "${akkord_sdk_path}/framework/core/platformwrapper/android/wrapper/"
java.srcDir "${akkord_sdk_path}/framework/core/platformwrapper/android/admob/"
java.srcDir "${akkord_sdk_path}/framework/core/platformwrapper/android/billing/"
java.srcDir '../java'
res.srcDirs = ['../res']
assets.srcDir '../../assets'
//assets.srcDir "${akkord_sdk_path}/resources/adimages/"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), file(proGuardParamsDir + 'proguard-rules_release.pro').absolutePath
signingConfig signingConfigs.release
ndk { debugSymbolLevel 'FULL' }
}
debug {
//minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), file(proGuardParamsDir + 'proguard-rules_debug.pro').absolutePath
signingConfig signingConfigs.release
}
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
//reset()
// Specifies a list of ABIs that Gradle should create APKs for.
//include "x86", "armeabi", "armeabi-v7a", "armeabi-v8a", "x86_64", "arm64-v8a"
//include "armeabi", "armeabi-v7a", "armeabi-v8a"
//include "x86", "armeabi", "armeabi-v7a", "armeabi-v8a", "x86_64", "arm64-v8a", "armeabi", "mips", "mips64"
//include "x86_64"
//include "armeabi-v7a"
//include "x86"
//include "arm64-v8a", "x86", "armeabi-v7a"
// generate a universal APK that includes all ABIs.
universalApk true
}
}
flavorDimensions "Store"
productFlavors {
googlePlay {
dimension "Store"
versionCode 1
splits {
abi {
enable false
}
}
sourceSets {
googlePlay {
manifest.srcFile "../customization/google_play/manifest_permissions.xml"
}
}
}
samsung {
dimension "Store"
versionCode 6
externalNativeBuild {
ndkBuild {
cFlags "-D__ALTERNATIVE_STORE__"
}
}
splits {
abi {
enable true
}
}
sourceSets {
samsung {
manifest.srcFile "../customization/samsung/manifest_permissions.xml"
}
}
}
alternativeStore {
dimension "Store"
versionCode 98
externalNativeBuild {
ndkBuild {
cFlags "-D__ALTERNATIVE_STORE__"
}
}
splits {
abi {
enable true
universalApk true
}
}
}
}
onVariantProperties {
for (output in outputs) {
def processedVersionCode = output.versionCode.map { playVersionCode -> "$playVersionCode" }
output.versionName.set(processedVersionCode)
}
}
}
play {
track.set("internal")
defaultToAppBundles.set(true)
//releaseName.set(new Date().format('yyyyMMddHHmmss'));
promoteTrack.set("alpha")
fromTrack.set("internal")
serviceAccountCredentials.set(file(System.getenv('ANDROID_KEYSTORE_HOME') + "/google_play_api_credentials.json"))
resolutionStrategy.set(com.github.triplet.gradle.androidpublisher.ResolutionStrategy.AUTO)
}
//// Map for the version code that gives each ABI a value.
//ext.abiCodes = ['armeabi-v7a' :1,
// 'x86' :2,
// 'x86_64' :3,
// 'arm64-v8a' :4
// ]
//
//import com.android.build.OutputFile
//
//// For each APK output variant, override versionCode with a combination of
//// ext.abiCodes * 1000 + variant.versionCode. In this example, variant.versionCode
//// is equal to defaultConfig.versionCode. If you configure product flavors that
//// define their own versionCode, variant.versionCode uses that value instead.
//android.applicationVariants.all { variant ->
//
// // Assigns a different version code for each output APK
// // other than the universal APK.
// variant.outputs.each { output ->
//
// // Stores the value of ext.abiCodes that is associated with the ABI for this variant.
// def baseAbiVersionCode =
// // Determines the ABI for this variant and returns the mapped value.
// project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
//
// // Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
// // the following code does not override the version code for universal APKs.
// // However, because we want universal APKs to have the lowest version code,
// // this outcome is desirable.
// if (baseAbiVersionCode != null) {
//
// // Assigns the new version code to versionCodeOverride, which changes the version code
// // for only the output APK, not for the variant itself. Skipping this step simply
// // causes Gradle to use the value of variant.versionCode for the APK.
// output.versionCodeOverride =
// baseAbiVersionCode + variant.versionCode
// }
// }
//}
dependencies {
implementation 'com.getkeepsafe.relinker:relinker:1.4.1'
implementation 'com.google.android.gms:play-services-ads:20.0.0'
implementation 'com.android.billingclient:billing:3.0.0'
implementation 'com.google.firebase:firebase-core:18.0.2'
implementation 'com.google.android.gms:play-services-games:21.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.play:core:1.10.0'
//implementation 'com.google.android.material:material:1.3.0-alpha03'
//implementation 'com.android.support:design:22.2.0'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment