Jelajahi Sumber

fix example and migrate to androidx

Luke Freeman 5 tahun lalu
induk
melakukan
9a3ad8d03f

+ 15 - 16
example/android/app/build.gradle

@@ -1,19 +1,18 @@
 apply plugin: 'com.android.application'
 apply plugin: 'kotlin-android'
-apply from: "../config.gradle"
 apply from: "../flutter.gradle"
 
 android {
-	compileSdkVersion versions.targetSDK
-	buildToolsVersion "${versions.buildTools}"
+	compileSdkVersion 29
+	buildToolsVersion "29.0.3"
 
 	defaultConfig {
-		minSdkVersion versions.minSDK
-		targetSdkVersion versions.targetSDK
-		applicationId "$appInfo.applicationID"
-		versionCode appInfo.build
-		versionName "${appInfo.version}"
-		testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+		minSdkVersion 24
+		targetSdkVersion 29
+		applicationId "app.yakka.fluroexample"
+		versionCode 1
+		versionName "1.6.0"
+		testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 	}
 	lintOptions {
 		disable 'InvalidPackage'
@@ -30,13 +29,13 @@ android {
 dependencies {
 	implementation fileTree(dir: 'libs', include: ['*.jar'])
 	// kotlin
-	implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
+	implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
 	// google
-	implementation "com.android.support:appcompat-v7:${versions.googleSupport}"
-	implementation "com.android.support:support-v13:${versions.googleSupport}"
-	implementation "com.android.support:support-v4:${versions.googleSupport}"
+	implementation 'androidx.appcompat:appcompat:1.1.0'
+	implementation 'androidx.legacy:legacy-support-v13:1.0.0'
+	implementation 'androidx.legacy:legacy-support-v4:1.0.0'
 	// testing
-	androidTestImplementation "com.android.support:support-annotations:${versions.googleSupport}"
-	androidTestImplementation 'com.android.support.test:runner:1.0.1'
-	androidTestImplementation 'com.android.support.test:rules:1.0.1'
+	androidTestImplementation 'androidx.annotation:annotation:1.1.0'
+	androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+	androidTestImplementation 'androidx.test:rules:1.2.0'
 }

+ 6 - 9
example/android/app/src/main/java/com/goposse/fluro/activities/MainActivity.kt

@@ -9,7 +9,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant
 
 class MainActivity : FlutterActivity() {
 
-	private val LOG_TAG = "A:Main"
+	private val logTag = "A:Main"
 
 	override fun onCreate(savedInstanceState: Bundle?) {
 		super.onCreate(savedInstanceState)
@@ -17,16 +17,13 @@ class MainActivity : FlutterActivity() {
 		checkForLinkEvent(intent)
 	}
 
-	override fun onResume() {
-		super.onResume()
-	}
-
 	private fun checkForLinkEvent(intent: Intent) {
-		if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
-			val path = intent.data.getQueryParameter("path")
-			val text = intent.data.getQueryParameter("message") ?: "Why you don't enter text?"
+		val data = intent.data
+		if (intent.action == Intent.ACTION_VIEW && data != null) {
+			val path = data.getQueryParameter("path")
+			val text = data.getQueryParameter("message") ?: "Why you don't enter text?"
 			if (path != null) {
-				Log.d(LOG_TAG, "Setting initial route to: $path?message=$text")
+				Log.d(logTag, "Setting initial route to: $path?message=$text")
 				flutterView.setInitialRoute("$path?message=$text")
 			}
 		}

+ 2 - 2
example/android/build.gradle

@@ -1,12 +1,12 @@
 buildscript {
-	ext.kotlin_version = '1.2.30'
+	ext.kotlin_version = '1.3.61'
 	repositories {
 		google()
         jcenter()
 	}
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.0.1'
+        classpath 'com.android.tools.build:gradle:3.5.3'
 		classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
 	}
 }

+ 4 - 4
example/android/config.gradle

@@ -1,13 +1,13 @@
 ext.appInfo = [
-		version: '1.3.0',
+		version: '1.6.0',
 		build: 1,
 		applicationID: "com.goposse.fluro"
 ]
 
 ext.versions = [
 		minSDK: 21,
-		targetSDK: 27,
-		buildTools: '27.0.3',
-		kotlin: '1.2.30',
+		targetSDK: 29,
+		buildTools: '29.0.3',
+		kotlin: '1.3.61',
 		googleSupport: '27.1.0'
 ]

+ 3 - 0
example/android/gradle.properties

@@ -1 +1,4 @@
 org.gradle.jvmargs=-Xmx1536M
+android.enableR8=true
+android.useAndroidX=true
+android.enableJetifier=true

+ 10 - 0
example/ios/Flutter/flutter_export_environment.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=/home/luke/Development/.sdks/flutter"
+export "FLUTTER_APPLICATION_PATH=/home/luke/Development/yakka/fluro/fluro-flutter/example"
+export "FLUTTER_TARGET=lib/main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "SYMROOT=${SOURCE_ROOT}/../build/ios"
+export "FLUTTER_FRAMEWORK_DIR=/home/luke/Development/.sdks/flutter/bin/cache/artifacts/engine/ios"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1"

+ 3 - 0
example/ios/Runner/GeneratedPluginRegistrant.h

@@ -7,8 +7,11 @@
 
 #import <Flutter/Flutter.h>
 
+NS_ASSUME_NONNULL_BEGIN
+
 @interface GeneratedPluginRegistrant : NSObject
 + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
 @end
 
+NS_ASSUME_NONNULL_END
 #endif /* GeneratedPluginRegistrant_h */

+ 1 - 1
pubspec.yaml

@@ -8,7 +8,7 @@ homepage: https://github.com/theyakka/fluro
 
 environment:
   sdk: ">=2.1.0 <3.0.0"
-  flutter: ">=1.2.0"
+  flutter: ">=1.5.0 <1.13.0"
 
 dependencies:
   flutter: