Skip to content

Commit

Permalink
Deprecated imperative apply of Flutter's Gradle plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvanMo committed Feb 19, 2024
1 parent fcc668c commit 1cb0f1b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
13 changes: 8 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ allprojects {
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
namespace "com.jarvan.fluwx"
compileSdk 31
if (project.android.hasProperty("namespace")) {
namespace 'com.jarvan.fluwx'
}

compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}

sourceSets {
Expand Down
15 changes: 6 additions & 9 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
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()) {
Expand All @@ -6,11 +12,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) {
flutterVersionCode = '1'
Expand All @@ -21,10 +22,6 @@ 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 "com.jarvan.fluwx_example"
compileSdkVersion flutter.compileSdkVersion
Expand Down
13 changes: 0 additions & 13 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand Down
14 changes: 10 additions & 4 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ pluginManagement {

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

include ":app"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
include ":app"

0 comments on commit 1cb0f1b

Please sign in to comment.