Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.2.0

- Migrated to built-in Kotlin (AGP 9.0 compatibility). Removed `apply plugin: 'kotlin-android'` and the Kotlin Gradle Plugin classpath from `android/build.gradle`; same change in the example app's `example/android/app/build.gradle`. The `kotlin.compilerOptions { jvmTarget = JVM_17 }` block is now used in place of the legacy `kotlinOptions` block.
- Bumped minimum Dart SDK to 3.12.0 and minimum Flutter version to 3.44.0, as required by the new built-in Kotlin DSL.
- Example app: enabled `android.builtInKotlin=true` and `android.newDsl=true` in `example/android/gradle.properties`.

## 2.1.2

- [iOS] Fix iOS crash when popping QR scanner page during resume (#21)
Expand Down
14 changes: 6 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ group 'net.touchcapture.qr.flutterqrplus'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}

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

Expand All @@ -22,7 +20,6 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdk 36
Expand All @@ -38,10 +35,6 @@ android {
multiDexEnabled true
}

kotlinOptions {
jvmTarget = '17'
}

compileOptions {
// Flag to enable support for the new language APIs
// // // coreLibraryDesugaringEnabled true
Expand All @@ -55,9 +48,14 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.zxing:core:3.5.2'
// // // coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
Comment on lines +57 to +61

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If a consuming app has not yet migrated to built-in Kotlin (i.e., they do not have android.builtInKotlin=true in their gradle.properties), the kotlin extension will not be registered on this project. This will cause the build to fail with a MissingMethodException when trying to evaluate the kotlin block.

To make this configuration safe and backward-compatible, wrap the kotlin block inside plugins.withId('org.jetbrains.kotlin.android'). This ensures the block is only evaluated if the Kotlin plugin is actually applied.

plugins.withId('org.jetbrains.kotlin.android') {
    kotlin {
        compilerOptions {
            jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
        }
    }
}

7 changes: 4 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

Expand Down Expand Up @@ -56,6 +55,8 @@ flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
8 changes: 6 additions & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
Comment thread
AlexDochioiu marked this conversation as resolved.
Comment thread
AlexDochioiu marked this conversation as resolved.
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.nonFinalResIds=false
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=true
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=true
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: qr_code_scanner_plus
description: QR code scanner that can be embedded inside flutter. It uses zxing in Android and AVFoundation in iOS.
version: 2.1.2
version: 2.2.0
homepage: https://vespr.xyz
repository: https://github.com/vespr-wallet/qr_code_scanner_plus

environment:
sdk: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
sdk: ^3.12.0
flutter: '>=3.44.0'

dependencies:
# js: ^0.6.3
Expand Down