From c581bd33ea29f1ff782d764f437b998d4d64beb2 Mon Sep 17 00:00:00 2001 From: Richard Naeve Date: Thu, 9 Jan 2020 16:38:57 +0100 Subject: [PATCH 1/2] Updated sdk version --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 3bd566d..62e7714 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -20,12 +20,12 @@ allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 25 + compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - minSdkVersion = 14 + minSdkVersion = 28 } lintOptions { disable 'InvalidPackage' From 82ccef031b7549d5fa71aae4e458a24303d77004 Mon Sep 17 00:00:00 2001 From: Richard Naeve Date: Thu, 30 Jan 2020 14:50:31 +0100 Subject: [PATCH 2/2] changed package to use android x and reverted to minsdk 16 --- .gitignore | 4 ++++ android/build.gradle | 11 ++++++----- example/android/app/build.gradle | 33 ++++++++++++++++++++----------- example/android/gradle.properties | 1 + example/lib/main.dart | 2 +- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 14c7d4c..d8752cd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ build/ ios/.generated/ packages pubspec.lock +.dart_tool/package_config.json +example/.flutter-plugins-dependencies +example/.dart_tool/package_config.json +example/ios/Flutter/flutter_export_environment.sh diff --git a/android/build.gradle b/android/build.gradle index 62e7714..58ea6f3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,16 +3,18 @@ version '1.0-SNAPSHOT' buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:3.5.0' } } -allprojects { +rootProject.allprojects { repositories { + google() jcenter() } } @@ -21,11 +23,10 @@ apply plugin: 'com.android.library' android { compileSdkVersion 28 - buildToolsVersion '28.0.3' defaultConfig { - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - minSdkVersion = 28 + minSdkVersion 16 + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { disable 'InvalidPackage' diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index bb80993..4087292 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,8 +1,8 @@ def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { - localPropertiesFile.withInputStream { stream -> - localProperties.load(stream) + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) } } @@ -11,24 +11,34 @@ if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 25 - buildToolsVersion '28.0.3' + compileSdkVersion 28 lintOptions { disable 'InvalidPackage' } defaultConfig { - minSdkVersion 16 - - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "bz.rxla.flutter.speechrecognitionexample" + minSdkVersion 16 + targetSdkVersion 28 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -45,8 +55,7 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' -} + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +} \ No newline at end of file diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..7be3d8b 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,2 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true diff --git a/example/lib/main.dart b/example/lib/main.dart index a5094aa..94b5c11 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -152,7 +152,7 @@ class _MyAppState extends State { void onRecognitionResult(String text) => setState(() => transcription = text); - void onRecognitionComplete() => setState(() => _isListening = false); + void onRecognitionComplete(String s) => setState(() => _isListening = false); void errorHandler() => activateSpeechRecognizer(); }