Navaron Bracke

update example app Gradle settings

@@ -48,6 +48,18 @@ android { @@ -48,6 +48,18 @@ android {
48 defaultConfig { 48 defaultConfig {
49 minSdkVersion 21 49 minSdkVersion 21
50 } 50 }
  51 +
  52 + testOptions {
  53 + unitTests.all {
  54 + useJUnitPlatform()
  55 +
  56 + testLogging {
  57 + events "passed", "skipped", "failed", "standardOut", "standardError"
  58 + outputs.upToDateWhen {false}
  59 + showStandardStreams = true
  60 + }
  61 + }
  62 + }
51 } 63 }
52 64
53 dependencies { 65 dependencies {
@@ -69,15 +81,3 @@ dependencies { @@ -69,15 +81,3 @@ dependencies {
69 testImplementation 'org.jetbrains.kotlin:kotlin-test' 81 testImplementation 'org.jetbrains.kotlin:kotlin-test'
70 testImplementation 'org.mockito:mockito-core:5.0.0' 82 testImplementation 'org.mockito:mockito-core:5.0.0'
71 } 83 }
72 -  
73 -testOptions {  
74 - unitTests.all {  
75 - useJUnitPlatform()  
76 -  
77 - testLogging {  
78 - events "passed", "skipped", "failed", "standardOut", "standardError"  
79 - outputs.upToDateWhen {false}  
80 - showStandardStreams = true  
81 - }  
82 - }  
83 -}  
  1 +plugins {
  2 + id "com.android.application"
  3 + id "kotlin-android"
  4 + id "dev.flutter.flutter-gradle-plugin"
  5 +}
  6 +
1 def localProperties = new Properties() 7 def localProperties = new Properties()
2 def localPropertiesFile = rootProject.file('local.properties') 8 def localPropertiesFile = rootProject.file('local.properties')
3 if (localPropertiesFile.exists()) { 9 if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
6 } 12 }
7 } 13 }
8 14
9 -def flutterRoot = localProperties.getProperty('flutter.sdk')  
10 -if (flutterRoot == null) {  
11 - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")  
12 -}  
13 -  
14 def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 if (flutterVersionCode == null) { 16 if (flutterVersionCode == null) {
16 flutterVersionCode = '1' 17 flutterVersionCode = '1'
@@ -21,12 +22,10 @@ if (flutterVersionName == null) { @@ -21,12 +22,10 @@ if (flutterVersionName == null) {
21 flutterVersionName = '1.0' 22 flutterVersionName = '1.0'
22 } 23 }
23 24
24 -apply plugin: 'com.android.application'  
25 -apply plugin: 'kotlin-android'  
26 -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"  
27 -  
28 android { 25 android {
  26 + namespace "dev.steenbakker.mobile_scanner_example"
29 compileSdkVersion 33 27 compileSdkVersion 33
  28 + ndkVersion flutter.ndkVersion
30 29
31 compileOptions { 30 compileOptions {
32 sourceCompatibility JavaVersion.VERSION_1_8 31 sourceCompatibility JavaVersion.VERSION_1_8
@@ -57,7 +56,6 @@ android { @@ -57,7 +56,6 @@ android {
57 signingConfig signingConfigs.debug 56 signingConfig signingConfigs.debug
58 } 57 }
59 } 58 }
60 - namespace 'dev.steenbakker.mobile_scanner_example'  
61 } 59 }
62 60
63 flutter { 61 flutter {
1 -include ':app' 1 +pluginManagement {
  2 + def flutterSdkPath = {
  3 + def properties = new Properties()
  4 + file("local.properties").withInputStream { properties.load(it) }
  5 + def flutterSdkPath = properties.getProperty("flutter.sdk")
  6 + assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
  7 + return flutterSdkPath
  8 + }
  9 + settings.ext.flutterSdkPath = flutterSdkPath()
2 10
3 -def localPropertiesFile = new File(rootProject.projectDir, "local.properties")  
4 -def properties = new Properties() 11 + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
  12 +}
5 13
6 -assert localPropertiesFile.exists()  
7 -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 14 +include ":app"
8 15
9 -def flutterSdkPath = properties.getProperty("flutter.sdk")  
10 -assert flutterSdkPath != null, "flutter.sdk not set in local.properties"  
11 -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 16 +apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"