Skip to content

Commit

Permalink
refactored the build.graddle
Browse files Browse the repository at this point in the history
  • Loading branch information
softdelaxe committed Nov 11, 2024
1 parent 8dd638c commit a5988a7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
79 changes: 37 additions & 42 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,67 +1,62 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
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"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

buildscript {
ext.kotlin_version = '1.7.10' // Set Kotlin version here
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}

android {
compileSdkVersion 33
applicationId "co.paystack.flutterpaystack"
compileSdk = 34
ndkVersion = flutter.ndkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lint {
disable 'InvalidPackage' // Use `lint` if your Gradle version supports it
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "co.paystack.flutterpaystack"
minSdkVersion 16
targetSdkVersion 33
versionCode 1
versionName "1.0"
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.softdelaxe.rent24"
// 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.
minSdk = 16
targetSdk = 34
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

kotlinOptions {
jvmTarget = "1.8"
}
buildTypes {
release {
signingConfig signingConfigs.debug
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}

kotlinOptions {
jvmTarget = "1.8" // Set to "17" if using Java 17
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 // Change to 17 if needed
targetCompatibility = JavaVersion.VERSION_1_8 // Change to 17 if needed
}
}


flutter {
source '../..'
}
}
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip

0 comments on commit a5988a7

Please sign in to comment.