| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- def localProperties = new Properties()
- def localPropertiesFile = rootProject.file('local.properties')
- if (localPropertiesFile.exists()) {
- localPropertiesFile.withReader('UTF-8') { reader ->
- localProperties.load(reader)
- }
- }
- def flutterRoot = localProperties.getProperty('flutter.sdk')
- if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
- }
- def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
- if (flutterVersionCode == null) {
- flutterVersionCode = '1'
- }
- def flutterVersionName = localProperties.getProperty('flutter.versionName')
- if (flutterVersionName == null) {
- flutterVersionName = '1.0'
- }
- def keystoreProperties = new Properties()
- def keystorePropertiesFile = rootProject.file('key.properties')
- if (keystorePropertiesFile.exists()) {
- keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
- }
- apply plugin: 'com.android.application'
- apply plugin: 'kotlin-android'
- apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
- android {
- namespace "com.beswell.trackoffical_app"
- compileSdkVersion 33
- // compileSdkVersion flutter.compileSdkVersion
- // ndkVersion flutter.ndkVersion
- ndkVersion "25.1.8937393"
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- kotlinOptions {
- jvmTarget = '1.8'
- }
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- }
- defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.beswell.trackoffical_app"
- // You can update the following values to match your application needs.
- // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
- // minSdkVersion flutter.minSdkVersion
- // targetSdkVersion flutter.targetSdkVersion
- minSdkVersion 23
- targetSdkVersion 33
- versionCode flutterVersionCode.toInteger()
- versionName flutterVersionName
- }
- signingConfigs {
- release {
- keyAlias keystoreProperties['keyAlias']
- keyPassword keystoreProperties['keyPassword']
- storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
- storePassword keystoreProperties['storePassword']
- }
- }
- buildTypes {
- release {
- // TODO: Add your own signing config for the release build.
- // Signing with the debug keys for now, so `flutter run --release` works.
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.debug
- }
- }
- flavorDimensions "default"
- productFlavors {
- dev {
- dimension "default"
- resValue "string", "app_name", "dev flavor example"
- applicationIdSuffix ".dev"
- }
- prod {
- dimension "default"
- resValue "string", "app_name", "dev flavor example"
- }
- }
- }
- flutter {
- source '../..'
- }
- dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
- implementation "com.squareup.okhttp3:okhttp:4.10.0"
- }
- [
- DevDebug: null,
- DevRelease: '--release',
- Profile: '--release',
- ProdRelease: '--release',
- ].each {
- def taskPostfix = it.key
- def profileMode = it.value
- tasks.whenTaskAdded { task ->
- if (task.name == "javaPreCompile$taskPostfix") {
- task.dependsOn "cargoBuild$taskPostfix"
- }
- }
- tasks.register("cargoBuild$taskPostfix", Exec) {
- workingDir "../../third_party/appcore"
- // environment ANDROID_NDK_HOME: "$ANDROID_NDK"
- commandLine 'cargo', 'ndk',
- // the 2 ABIs below are used by real Android devices
- '-t', 'armeabi-v7a',
- '-t', 'arm64-v8a',
- // the below 2 ABIs are usually used for Android simulators,
- // add or remove these ABIs as needed.
- '-t', 'x86_64',
- '-o', '../../android/app/src/main/jniLibs', 'build'
- if (profileMode != null) {
- args profileMode
- }
- }
- }
|