Skip to content

Commit 138736b

Browse files
authored
Merge pull request #103 from PirateBrook/master
Add Gradle 8 support
2 parents 5fe4c94 + 6e3598b commit 138736b

File tree

8 files changed

+59
-26
lines changed

8 files changed

+59
-26
lines changed

android/build.gradle

+13-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ apply plugin: 'com.android.library'
2626
apply plugin: 'kotlin-android'
2727

2828
android {
29+
if (project.android.hasProperty('namespace')) {
30+
namespace 'com.linecorp.flutter_line_sdk'
31+
}
2932
compileSdk 33
3033

3134
sourceSets {
@@ -39,6 +42,15 @@ android {
3942
lintOptions {
4043
disable 'InvalidPackage'
4144
}
45+
46+
compileOptions {
47+
sourceCompatibility JavaVersion.VERSION_1_8
48+
targetCompatibility JavaVersion.VERSION_1_8
49+
}
50+
51+
kotlinOptions {
52+
jvmTarget = '1.8'
53+
}
4254
}
4355

4456
dependencies {
@@ -47,7 +59,7 @@ dependencies {
4759
exclude group: 'androidx.lifecycle', module: 'lifecycle-extensions'
4860
}
4961
implementation 'com.google.code.gson:gson:2.8.5'
50-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
62+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
5163
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1"
5264
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1"
5365
}

example/android/app/build.gradle

+17-8
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,10 +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-
}
1315

1416
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1517
if (flutterVersionCode == null) {
@@ -21,11 +23,10 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '1.0'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26+
2727

2828
android {
29+
namespace 'com.linecorp.linesdk.sample'
2930
compileSdk 33
3031

3132
sourceSets {
@@ -46,6 +47,15 @@ android {
4647
multiDexEnabled true
4748
}
4849

50+
compileOptions {
51+
sourceCompatibility JavaVersion.VERSION_17
52+
targetCompatibility JavaVersion.VERSION_17
53+
}
54+
55+
kotlinOptions {
56+
jvmTarget = '17'
57+
}
58+
4959
buildTypes {
5060
debug {
5161
// for proguard verification
@@ -63,7 +73,6 @@ flutter {
6373
}
6474

6575
dependencies {
66-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
6776
testImplementation 'junit:junit:4.12'
6877
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
6978
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

example/android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.7.21'
2+
ext.kotlin_version = '2.0.0'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.3.1'
9+
classpath 'com.android.tools.build:gradle:8.4.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

example/android/gradle.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true
4+
android.defaults.buildfeatures.buildconfig=true
5+
android.nonTransitiveRClass=false
6+
android.nonFinalResIds=false

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

+1-1
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.6-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

example/android/settings.gradle

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
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+
}()
29

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
411

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
917
}
1018

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.4.0" apply false
22+
id "org.jetbrains.kotlin.android" version "2.0.0" apply false
1523
}
24+
25+
include ":app"

example/pubspec.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ packages:
4545
dependency: "direct main"
4646
description:
4747
name: cupertino_icons
48-
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
48+
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
4949
url: "https://pub.dev"
5050
source: hosted
51-
version: "1.0.6"
51+
version: "1.0.8"
5252
fake_async:
5353
dependency: transitive
5454
description:

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212

1313
# The following adds the Cupertino Icons font to your application.
1414
# Use with the CupertinoIcons class for iOS style icons.
15-
cupertino_icons: ^1.0.5
15+
cupertino_icons: ^1.0.8
1616

1717
dev_dependencies:
1818
flutter_test:

0 commit comments

Comments
 (0)