Skip to content

Commit c3e4a1e

Browse files
authored
Android AGP upgrade (#649)
1 parent 9f00bf8 commit c3e4a1e

File tree

4 files changed

+43
-39
lines changed

4 files changed

+43
-39
lines changed

example/android/app/build.gradle

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,27 +22,27 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
29-
compileSdkVersion 34
26+
namespace 'io.livekit.example'
27+
compileSdk 34
3028

3129
sourceSets {
3230
main.java.srcDirs += 'src/main/kotlin'
3331
}
3432

35-
// compileOptions {
36-
// sourceCompatibility JavaVersion.VERSION_1_8
37-
// targetCompatibility JavaVersion.VERSION_1_8
38-
// }
33+
compileOptions {
34+
sourceCompatibility JavaVersion.VERSION_21
35+
targetCompatibility JavaVersion.VERSION_21
36+
}
37+
kotlinOptions {
38+
jvmTarget = JavaVersion.VERSION_21
39+
}
3940

4041
defaultConfig {
4142
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4243
applicationId "io.livekit.example"
43-
minSdkVersion 21
44-
targetSdkVersion 34
44+
minSdk 21
45+
targetSdk 34
4546
versionCode flutterVersionCode.toInteger()
4647
versionName flutterVersionName
4748
}

example/android/build.gradle

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.1'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
2+
ext.kotlin_version = '2.0.21'
153
repositories {
164
google()
17-
jcenter()
5+
mavenCentral()
186
}
197
}
208

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

example/android/settings.gradle

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}
9+
settings.ext.flutterSdkPath = flutterSdkPath()
210

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
11+
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
512

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
18+
}
819

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
20+
plugins {
21+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22+
id "com.android.application" version '8.7.2' apply false
23+
id "org.jetbrains.kotlin.android" version "2.0.21" apply false
24+
}
25+
26+
include ":app"

0 commit comments

Comments
 (0)