From c2042113a5c90bc7f6e2810934d5556a1edfe096 Mon Sep 17 00:00:00 2001 From: kaumudpa Date: Mon, 16 May 2022 01:20:07 +0530 Subject: [PATCH] Bump version to 3.0.2. Now compatible with Flutter V3 Resolved #58. Upgraded `build:gradle:7.1.2` and compileSdkVersion to 31. Gradle Version upgraded to - 7.4 - inline with flutter V3.0 Resolved kotlin compile errors as thrown in flutter V3.0 --- android/build.gradle | 23 ++++++++++++------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../com/air/ai_barcode/AndroidCreatorView.kt | 2 +- .../ai_barcode/AndroidCreatorViewFactory.kt | 2 +- .../com/air/ai_barcode/AndroidScannerView.kt | 2 +- .../ai_barcode/AndroidScannerViewFactory.kt | 2 +- pubspec.yaml | 4 ++-- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index ff26e36..dcb71ee 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,11 +5,12 @@ buildscript { ext.kotlin_version = '1.6.10' repositories { google() + // mavenCentral() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -17,6 +18,7 @@ buildscript { rootProject.allprojects { repositories { google() + // mavenCentral() jcenter() } } @@ -25,22 +27,27 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 28 + compileSdkVersion 31 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' } + defaultConfig { minSdkVersion 16 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - lintOptions { - disable 'InvalidPackage' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - //Scanner(https://github.com/dm77/barcodescanner) - implementation 'me.dm7.barcodescanner:zxing:1.9.13' + implementation 'me.dm7.barcodescanner:zxing:1.9.13' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 01a286e..7e5645e 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip \ No newline at end of file diff --git a/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorView.kt b/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorView.kt index 05a1157..442d500 100644 --- a/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorView.kt +++ b/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorView.kt @@ -29,7 +29,7 @@ import java.util.* * Create QRCode view *

*/ -class AndroidCreatorView(binaryMessenger: BinaryMessenger, context: Context, viewid: Int, args: Any?) : PlatformView, MethodChannel.MethodCallHandler, EventChannel.StreamHandler { +class AndroidCreatorView(binaryMessenger: BinaryMessenger, context: Context?, viewid: Int, args: Any?) : PlatformView, MethodChannel.MethodCallHandler, EventChannel.StreamHandler { /** * 用于向Flutter发送数据 */ diff --git a/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorViewFactory.kt b/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorViewFactory.kt index ab9bcc6..0e49275 100644 --- a/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorViewFactory.kt +++ b/android/src/main/kotlin/com/air/ai_barcode/AndroidCreatorViewFactory.kt @@ -13,7 +13,7 @@ import io.flutter.plugin.platform.PlatformViewFactory */ class AndroidCreatorViewFactory(private var binaryMessenger: BinaryMessenger) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { - override fun create(context: Context, viewId: Int, args: Any?): PlatformView { + override fun create(context: Context?, viewId: Int, args: Any?): PlatformView { return AndroidCreatorView(binaryMessenger, context, viewId, args); } } \ No newline at end of file diff --git a/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerView.kt b/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerView.kt index 857b69c..c9d2d59 100644 --- a/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerView.kt +++ b/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerView.kt @@ -17,7 +17,7 @@ import me.dm7.barcodescanner.zxing.ZXingScannerView * Created by air on 2019-12-02. *

*/ -class AndroidScannerView(binaryMessenger: BinaryMessenger, context: Context, viewid: Int, args: Any?) : PlatformView, MethodChannel.MethodCallHandler, EventChannel.StreamHandler, ZXingScannerView.ResultHandler { +class AndroidScannerView(binaryMessenger: BinaryMessenger, context: Context?, viewid: Int, args: Any?) : PlatformView, MethodChannel.MethodCallHandler, EventChannel.StreamHandler, ZXingScannerView.ResultHandler { /** * 用于向Flutter发送数据 */ diff --git a/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerViewFactory.kt b/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerViewFactory.kt index f65c48c..c4b1fa0 100644 --- a/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerViewFactory.kt +++ b/android/src/main/kotlin/com/air/ai_barcode/AndroidScannerViewFactory.kt @@ -13,7 +13,7 @@ import io.flutter.plugin.platform.PlatformViewFactory */ class AndroidScannerViewFactory(private var binaryMessenger: BinaryMessenger) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { - override fun create(context: Context, viewId: Int, args: Any?): PlatformView { + override fun create(context: Context?, viewId: Int, args: Any?): PlatformView { return AndroidScannerView(binaryMessenger, context, viewId, args); } } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index e4f4758..01559c4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ai_barcode description: barcode,qrcode,scan,scanning,Barcode generation,Barcode scanning,qrcode,qrcode generation,qrcode creator -version: 3.0.1 +version: 3.0.2 homepage: https://pdliuw.github.io/ repository: https://github.com/pdliuw/ai_barcode @@ -19,7 +19,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - + flutter_lints: ^2.0.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec