diff --git a/android/app/build.gradle b/android/app/build.gradle index 9d678878..a5fc42bb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,3 +1,10 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,10 +13,6 @@ if (localPropertiesFile.exists()) { } } -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) { @@ -21,14 +24,9 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - namespace 'org.selfprivacy.app' - - compileSdkVersion flutter.compileSdkVersion + namespace 'org.selfprivacy.app' + compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion sourceSets { @@ -43,45 +41,50 @@ android { kotlinOptions { jvmTarget = '1.8' } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } lintOptions { disable 'InvalidPackage' } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "org.selfprivacy.app" minSdkVersion 21 - targetSdkVersion 33 - compileSdkVersion 33 + targetSdkVersion 34 + compileSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } + + buildTypes { + debug { - flavorDimensions "default" - productFlavors { - fdroid { - applicationId "pro.kherel.selfprivacy" } - production { - applicationIdSuffix "" + profile { + } - nightly { - applicationIdSuffix ".nightly" - versionCode project.getVersionCode() - versionName "nightly-" + project.getVersionCode() + release { + } } + buildFeatures { + flavorDimensions = ["default"] + } + - flavorDimensions "default" productFlavors { fdroid { + dimension 'default' applicationId "pro.kherel.selfprivacy" } production { - applicationIdSuffix "" + dimension 'default' } nightly { + dimension 'default' applicationIdSuffix ".nightly" versionCode project.getVersionCode() versionName "nightly-" + project.getVersionCode() @@ -93,6 +96,5 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} + diff --git a/android/build.gradle b/android/build.gradle index b1ba7da3..98a94fa2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.21' - ext.getVersionCode = { -> + ext.getVersionCode = { -> try { def stdout = new ByteArrayOutputStream() exec { @@ -13,15 +12,6 @@ buildscript { return -1 } } - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } } allprojects { diff --git a/android/gradle.properties b/android/gradle.properties index c396be2a..85faa95d 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true android.bundle.enableUncompressedNativeLibs=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 02e5f581..aeaff6f8 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/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-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bcf..14d2478f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.21" apply false +} + +include ":app" \ No newline at end of file