From 46c21c14d97694fe89446ae6468f1112ae4a2592 Mon Sep 17 00:00:00 2001 From: Jonatan Mendez Date: Mon, 18 Sep 2023 20:05:07 -0400 Subject: [PATCH 1/4] added compatibility with futterFragmentActivity --- .../FlutterBarcodeScannerPlugin.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java b/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java index 91480647..66d92b30 100644 --- a/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java +++ b/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java @@ -16,7 +16,8 @@ import java.util.Map; -import io.flutter.embedding.android.FlutterActivity; +// Added new FlutterFragmentActivity Here +import io.flutter.embedding.android.FlutterFragmentActivity; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.embedding.engine.plugins.activity.ActivityAware; @@ -39,7 +40,7 @@ public class FlutterBarcodeScannerPlugin implements MethodCallHandler, ActivityResultListener, StreamHandler, FlutterPlugin, ActivityAware { private static final String CHANNEL = "flutter_barcode_scanner"; - private static FlutterActivity activity; + private static FlutterFragmentActivity activity; private static Result pendingResult; private Map arguments; @@ -68,7 +69,7 @@ public class FlutterBarcodeScannerPlugin implements MethodCallHandler, ActivityR public FlutterBarcodeScannerPlugin() { } - private FlutterBarcodeScannerPlugin(FlutterActivity activity, final PluginRegistry.Registrar registrar) { + private FlutterBarcodeScannerPlugin(FlutterFragmentActivity activity, final PluginRegistry.Registrar registrar) { FlutterBarcodeScannerPlugin.activity = activity; } @@ -84,7 +85,7 @@ public static void registerWith(final PluginRegistry.Registrar registrar) { if (registrar.context() != null) { applicationContext = (Application) (registrar.context().getApplicationContext()); } - FlutterBarcodeScannerPlugin instance = new FlutterBarcodeScannerPlugin((FlutterActivity) registrar.activity(), registrar); + FlutterBarcodeScannerPlugin instance = new FlutterBarcodeScannerPlugin((FlutterFragmentActivity) registrar.activity(), registrar); instance.createPluginSetup(registrar.messenger(), applicationContext, activity, registrar, null); } @@ -245,7 +246,7 @@ private void createPluginSetup( final ActivityPluginBinding activityBinding) { - this.activity = (FlutterActivity) activity; + this.activity = (FlutterFragmentActivity) activity; eventChannel = new EventChannel(messenger, "flutter_barcode_scanner_receiver"); eventChannel.setStreamHandler(this); From 62aab35999a31ff1028007443594da18fa7ba2d6 Mon Sep 17 00:00:00 2001 From: Jonatan Mendez Date: Fri, 28 Jun 2024 12:30:22 -0400 Subject: [PATCH 2/4] remove deprecated manifest --- android/.idea/runConfigurations.xml | 12 ------------ android/src/main/AndroidManifest.xml | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 android/.idea/runConfigurations.xml diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460d..00000000 --- a/android/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 5d6847be..808af1b1 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + From dafcdcbece729d3ba8747e3986b4a6cd1faec581 Mon Sep 17 00:00:00 2001 From: Jonatan Mendez Date: Fri, 28 Jun 2024 12:31:07 -0400 Subject: [PATCH 3/4] modify build gradle --- android/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index f0f02e7a..0966b5aa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { @@ -15,7 +15,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -23,6 +23,9 @@ apply plugin: 'com.android.library' android { compileSdkVersion 30 + if (project.android.hasProperty("namespace")) { + namespace 'com.amolg.flutterbarcodescanner' + } defaultConfig { minSdkVersion 16 @@ -31,6 +34,9 @@ android { } lintOptions { disable 'InvalidPackage' + warning 'deprecation' + warning 'unchecked' + } } From 28adda47bbf552006b0ade02634fc1edbce36b3d Mon Sep 17 00:00:00 2001 From: Jonatan Mendez Date: Mon, 1 Jul 2024 14:49:05 -0400 Subject: [PATCH 4/4] updating gradle --- android/build.gradle | 30 ++++++++++++------- android/gradle.properties | 1 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 0966b5aa..856ec608 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,17 +2,18 @@ group 'com.amolg.flutterbarcodescanner' version '1.0-SNAPSHOT' buildscript { + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() } - dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath "com.android.tools.build:gradle:7.4.0" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } -rootProject.allprojects { +allprojects { repositories { google() mavenCentral() @@ -20,29 +21,36 @@ rootProject.allprojects { } apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' android { - compileSdkVersion 30 - if (project.android.hasProperty("namespace")) { - namespace 'com.amolg.flutterbarcodescanner' - } + compileSdkVersion 34 + namespace 'com.amolg.flutterbarcodescanner' defaultConfig { - minSdkVersion 16 - targetSdkVersion 30 + minSdkVersion 19 + targetSdkVersion 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - lintOptions { + + lint { disable 'InvalidPackage' warning 'deprecation' warning 'unchecked' + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.gms:play-services-vision:20.1.3' -} \ No newline at end of file +} + + diff --git a/android/gradle.properties b/android/gradle.properties index 53ae0ae4..deb6b802 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,4 @@ android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx1536M +org.gradle.warning.mode=all \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 9474641a..bb49de81 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip