From d0fc5308e48881810c4fb9c23b15e49397276ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Roger?= Date: Wed, 25 May 2022 13:53:08 +0200 Subject: [PATCH] Updating dependencies and compileSdkVersions, Closes LOC-9 (#128) * Updating versions of dependencies and compileSdkVersions * Fixes compilation warnings --- FantasmoDemoApp/app/build.gradle | 36 +++++++-------- .../app/src/main/AndroidManifest.xml | 3 +- .../fantasmo_android/CustomDemoFragment.kt | 2 +- .../example/fantasmo_android/DemoFragment.kt | 2 +- .../example/fantasmo_android/MainActivity.kt | 6 +-- .../helpers/SystemLocationManager.kt | 4 +- FantasmoDemoApp/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- FantasmoSDK/.idea/compiler.xml | 2 +- FantasmoSDK/.idea/gradle.xml | 7 +-- FantasmoSDK/.idea/misc.xml | 2 +- FantasmoSDK/app/build.gradle | 46 +++++++++---------- FantasmoSDK/app/src/main/AndroidManifest.xml | 4 +- .../tensorflowML/ImageQualityModelUpdater.kt | 16 ++++--- .../fantasmo/sdk/utilities/QRCodeScanner.kt | 2 +- .../com/fantasmo/sdk/views/FMARCoreView.kt | 2 +- .../sdk/views/FMParkingViewProtocol.kt | 2 +- FantasmoSDK/build.gradle | 9 ++-- .../gradle/wrapper/gradle-wrapper.properties | 4 +- 19 files changed, 82 insertions(+), 75 deletions(-) diff --git a/FantasmoDemoApp/app/build.gradle b/FantasmoDemoApp/app/build.gradle index f41f3db4..45d44387 100644 --- a/FantasmoDemoApp/app/build.gradle +++ b/FantasmoDemoApp/app/build.gradle @@ -13,12 +13,12 @@ android { keyPassword 'fantasmo' } } - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { applicationId "com.example.fantasmo_android" minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 2 versionName "2.0" multiDexEnabled = true @@ -73,36 +73,36 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.aar']) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.3.2' - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.1' + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.6.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' // Fragment Navigation - implementation "androidx.navigation:navigation-fragment-ktx:2.3.5" + implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' // Google ARCore - implementation 'com.google.ar:core:1.29.0' + implementation 'com.google.ar:core:1.31.0' // Location Services - implementation 'com.google.android.gms:play-services-location:18.0.0' - implementation 'com.google.android.gms:play-services-maps:17.0.1' + implementation 'com.google.android.gms:play-services-location:19.0.1' + implementation 'com.google.android.gms:play-services-maps:18.0.2' // Barcode model dependencies - implementation 'com.google.mlkit:barcode-scanning:17.0.0' + implementation 'com.google.mlkit:barcode-scanning:17.0.2' //GSON for JSON parse - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.android.volley:volley:1.2.0' + implementation 'com.google.code.gson:gson:2.9.0' + implementation 'com.android.volley:volley:1.2.1' // Tensor - implementation 'org.tensorflow:tensorflow-lite-support:0.1.0' - implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0' + implementation 'org.tensorflow:tensorflow-lite-support:0.4.0' + implementation 'org.tensorflow:tensorflow-lite-metadata:0.4.0' - implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0' + implementation 'org.tensorflow:tensorflow-lite-gpu:2.8.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } \ No newline at end of file diff --git a/FantasmoDemoApp/app/src/main/AndroidManifest.xml b/FantasmoDemoApp/app/src/main/AndroidManifest.xml index b0822814..1cf2bc64 100644 --- a/FantasmoDemoApp/app/src/main/AndroidManifest.xml +++ b/FantasmoDemoApp/app/src/main/AndroidManifest.xml @@ -24,7 +24,8 @@ android:value="@string/google_maps_key"/> + android:configChanges="keyboardHidden|orientation|screenSize" + android:exported="true"> diff --git a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/CustomDemoFragment.kt b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/CustomDemoFragment.kt index 55bac4dd..edcc484a 100644 --- a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/CustomDemoFragment.kt +++ b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/CustomDemoFragment.kt @@ -30,7 +30,7 @@ import com.fantasmo.sdk.views.FMParkingViewProtocol import com.fantasmo.sdk.views.FMQRScanningViewProtocol import com.google.android.gms.maps.MapView -import com.google.mlkit.vision.barcode.Barcode +import com.google.mlkit.vision.barcode.common.Barcode import java.util.* /** diff --git a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/DemoFragment.kt b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/DemoFragment.kt index 7f835c10..08ed7f24 100644 --- a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/DemoFragment.kt +++ b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/DemoFragment.kt @@ -21,7 +21,7 @@ import com.fantasmo.sdk.FMResultConfidence import com.fantasmo.sdk.models.ErrorResponse import com.fantasmo.sdk.views.FMParkingView import com.fantasmo.sdk.views.FMParkingViewProtocol -import com.google.mlkit.vision.barcode.Barcode +import com.google.mlkit.vision.barcode.common.Barcode import java.util.* /** diff --git a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/MainActivity.kt b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/MainActivity.kt index 13315fa8..814488e5 100644 --- a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/MainActivity.kt +++ b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/MainActivity.kt @@ -160,12 +160,12 @@ class MainActivity : AppCompatActivity() { private fun setStartDestination() { if (arcoreCompatibility) { if (SimulationUtils.useDemoFragment) { - graph.startDestination = R.id.arcore_fragment + graph.setStartDestination(R.id.arcore_fragment) } else { - graph.startDestination = R.id.custom_arcore_fragment + graph.setStartDestination(R.id.custom_arcore_fragment) } } else { - graph.startDestination = R.id.noarcore_fragment + graph.setStartDestination(R.id.noarcore_fragment) } navController.graph = graph } diff --git a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/helpers/SystemLocationManager.kt b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/helpers/SystemLocationManager.kt index a0e87cd9..cf25cb8a 100644 --- a/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/helpers/SystemLocationManager.kt +++ b/FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/helpers/SystemLocationManager.kt @@ -17,9 +17,9 @@ class SystemLocationManager( private val TAG = SystemLocationManager::class.java.simpleName private var locationManager: LocationManager = - context?.getSystemService(Context.LOCATION_SERVICE) as LocationManager + context!!.getSystemService(Context.LOCATION_SERVICE) as LocationManager private var fusedLocationClient: FusedLocationProviderClient = - LocationServices.getFusedLocationProviderClient(context) + LocationServices.getFusedLocationProviderClient(context!!) private var currentLocation: Location = Location("") private val locationInterval = 300L private var firstLocation = false diff --git a/FantasmoDemoApp/build.gradle b/FantasmoDemoApp/build.gradle index 2d7c3426..6d6b1973 100644 --- a/FantasmoDemoApp/build.gradle +++ b/FantasmoDemoApp/build.gradle @@ -1,12 +1,12 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.4.31" + ext.kotlin_version = '1.6.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.0.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Navigation diff --git a/FantasmoDemoApp/gradle/wrapper/gradle-wrapper.properties b/FantasmoDemoApp/gradle/wrapper/gradle-wrapper.properties index ae93c9dd..f2cc4618 100644 --- a/FantasmoDemoApp/gradle/wrapper/gradle-wrapper.properties +++ b/FantasmoDemoApp/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Nov 22 16:38:05 WET 2021 +#Wed May 18 16:35:46 CEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/FantasmoSDK/.idea/compiler.xml b/FantasmoSDK/.idea/compiler.xml index 61a9130c..fb7f4a8a 100644 --- a/FantasmoSDK/.idea/compiler.xml +++ b/FantasmoSDK/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/FantasmoSDK/.idea/gradle.xml b/FantasmoSDK/.idea/gradle.xml index f47fe877..7b46144d 100644 --- a/FantasmoSDK/.idea/gradle.xml +++ b/FantasmoSDK/.idea/gradle.xml @@ -4,19 +4,16 @@ diff --git a/FantasmoSDK/.idea/misc.xml b/FantasmoSDK/.idea/misc.xml index 516780af..eed71665 100644 --- a/FantasmoSDK/.idea/misc.xml +++ b/FantasmoSDK/.idea/misc.xml @@ -18,7 +18,7 @@ - + diff --git a/FantasmoSDK/app/build.gradle b/FantasmoSDK/app/build.gradle index ec9df7a2..c61679f8 100644 --- a/FantasmoSDK/app/build.gradle +++ b/FantasmoSDK/app/build.gradle @@ -5,8 +5,8 @@ plugins { } android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdkVersion 31 + buildToolsVersion "31.0.0" testOptions { unitTests { @@ -19,7 +19,7 @@ android { defaultConfig { minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 68 versionName "3.3.1" @@ -105,36 +105,36 @@ android { } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.3.2' - implementation 'com.android.volley:volley:1.2.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8' - implementation 'com.google.code.gson:gson:2.8.6' + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'com.android.volley:volley:1.2.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt' + implementation 'com.google.code.gson:gson:2.9.0' // ARCore - implementation 'com.google.ar:core:1.29.0' + implementation 'com.google.ar:core:1.31.0' // Location Manager - implementation 'com.google.android.gms:play-services-location:18.0.0' + implementation 'com.google.android.gms:play-services-location:19.0.1' // Barcode model dependencies - implementation 'com.google.mlkit:barcode-scanning:17.0.0' + implementation 'com.google.mlkit:barcode-scanning:17.0.2' // TensorFlow Lite - implementation 'org.tensorflow:tensorflow-lite-support:0.1.0' - implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0' - implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0' + implementation 'org.tensorflow:tensorflow-lite-support:0.4.0' + implementation 'org.tensorflow:tensorflow-lite-metadata:0.4.0' + implementation 'org.tensorflow:tensorflow-lite-gpu:2.8.0' // Layouts - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.1' - implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.6.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0' + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1-native-mt' testImplementation 'junit:junit:4.13.2' - testImplementation "org.robolectric:robolectric:4.5.1" - testImplementation "org.mockito:mockito-core:3.8.0" - testImplementation 'org.mockito:mockito-inline:2.13.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + testImplementation 'org.robolectric:robolectric:4.8.1' + testImplementation 'org.mockito:mockito-core:4.5.1' + testImplementation 'org.mockito:mockito-inline:4.5.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } diff --git a/FantasmoSDK/app/src/main/AndroidManifest.xml b/FantasmoSDK/app/src/main/AndroidManifest.xml index 13d1dba1..873bf2ca 100644 --- a/FantasmoSDK/app/src/main/AndroidManifest.xml +++ b/FantasmoSDK/app/src/main/AndroidManifest.xml @@ -15,7 +15,9 @@ - + diff --git a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/tensorflowML/ImageQualityModelUpdater.kt b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/tensorflowML/ImageQualityModelUpdater.kt index 68c15d91..387e3e46 100644 --- a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/tensorflowML/ImageQualityModelUpdater.kt +++ b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/tensorflowML/ImageQualityModelUpdater.kt @@ -55,7 +55,11 @@ class ImageQualityModelUpdater(val context: Context) { { response -> try { Log.d(TAG, "Model Network Response received, writing to file...") - val fileOutputStream = FileOutputStream(File(context.filesDir, fileName)) + val fileOutputStream = FileOutputStream(fileName?.let { + File(context.filesDir, + it + ) + }) fileOutputStream.write(response) fileOutputStream.close() Log.d(TAG, "Model File Successfully Downloaded.") @@ -115,8 +119,8 @@ class ImageQualityModelUpdater(val context: Context) { if(fileName == null) { return null } - val file = File(context.filesDir, fileName) - if (!file.exists()) { + val file = fileName?.let { File(context.filesDir, it) } + if (file == null || !file.exists()) { if (!hasRequestedModel) { if (hasRequestedUpdate) { Log.d(TAG, "New Model version: $modelVersion. Downloading it...") @@ -144,7 +148,7 @@ class ImageQualityModelUpdater(val context: Context) { Log.e(TAG, "Error on reading the model.") null } catch (e: Error) { - Log.e(TAG, e.localizedMessage) + e.localizedMessage?.let { Log.e(TAG, it) } null } catch (ex: Exception) { //could be delegate problem, trying again with CPU @@ -158,11 +162,11 @@ class ImageQualityModelUpdater(val context: Context) { firstRead = false interpreter } catch(ex: Exception) { - Log.e(TAG, ex.localizedMessage) + ex.localizedMessage?.let { Log.e(TAG, it) } null } } else { - Log.e(TAG, ex.localizedMessage) + ex.localizedMessage?.let { Log.e(TAG, it) } null } } diff --git a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/utilities/QRCodeScanner.kt b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/utilities/QRCodeScanner.kt index 08700ef0..d501fe8d 100644 --- a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/utilities/QRCodeScanner.kt +++ b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/utilities/QRCodeScanner.kt @@ -7,7 +7,7 @@ import android.util.Log import com.fantasmo.sdk.models.FMFrame import com.fantasmo.sdk.views.FMParkingViewProtocol import com.fantasmo.sdk.views.FMQRScanningViewProtocol -import com.google.mlkit.vision.barcode.Barcode +import com.google.mlkit.vision.barcode.common.Barcode import com.google.mlkit.vision.barcode.BarcodeScanner import com.google.mlkit.vision.barcode.BarcodeScannerOptions import com.google.mlkit.vision.barcode.BarcodeScanning diff --git a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMARCoreView.kt b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMARCoreView.kt index a2577989..0b2958fa 100644 --- a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMARCoreView.kt +++ b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMARCoreView.kt @@ -139,7 +139,7 @@ class FMARCoreView( config.cloudAnchorMode = Config.CloudAnchorMode.DISABLED config.lightEstimationMode = Config.LightEstimationMode.DISABLED config.depthMode = Config.DepthMode.DISABLED - config.augmentedImageDatabase = null + config.augmentedImageDatabase = AugmentedImageDatabase(arSession!!) var selectedSize = Size(0, 0) var selectedCameraConfig = 0 diff --git a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMParkingViewProtocol.kt b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMParkingViewProtocol.kt index 55280e92..52c40279 100644 --- a/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMParkingViewProtocol.kt +++ b/FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMParkingViewProtocol.kt @@ -3,7 +3,7 @@ package com.fantasmo.sdk.views import com.fantasmo.sdk.FMBehaviorRequest import com.fantasmo.sdk.FMLocationResult import com.fantasmo.sdk.models.ErrorResponse -import com.google.mlkit.vision.barcode.Barcode +import com.google.mlkit.vision.barcode.common.Barcode interface FMParkingViewProtocol { diff --git a/FantasmoSDK/build.gradle b/FantasmoSDK/build.gradle index 00fa8967..d3c17e60 100644 --- a/FantasmoSDK/build.gradle +++ b/FantasmoSDK/build.gradle @@ -1,15 +1,18 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.4.31" + ext.kotlin_version = '1.6.21' repositories { google() mavenCentral() + maven { + url 'https://storage.googleapis.com/r8-releases/raw' + } } dependencies { classpath 'org.robolectric:robolectric-gradle-plugin:1.0.1' - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - + classpath 'com.android.tools:r8:3.0.77' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/FantasmoSDK/gradle/wrapper/gradle-wrapper.properties b/FantasmoSDK/gradle/wrapper/gradle-wrapper.properties index 8a527974..10be32f4 100644 --- a/FantasmoSDK/gradle/wrapper/gradle-wrapper.properties +++ b/FantasmoSDK/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Nov 22 16:40:21 WET 2021 +#Wed May 18 17:22:33 CEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME