From ad5295d178c26d8a449bf8de05730338ad36db16 Mon Sep 17 00:00:00 2001 From: Amey Bansod Date: Wed, 22 Nov 2023 03:57:05 -0500 Subject: [PATCH 1/2] Gradle upgrade, successfully up & running with Android Studio Giraffe | 2022.3.1 Patch 4 on Pixel 6 pro --- .../android/app/build.gradle | 12 +++++++++--- .../android/app/src/main/AndroidManifest.xml | 3 +-- .../app/src/main/res/layout/tfe_is_activity_main.xml | 4 ++-- .../android/build.gradle | 11 ++++++++--- .../android/gradle.properties | 5 ++++- .../android/gradle/wrapper/gradle-wrapper.properties | 3 ++- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lite/examples/optical_character_recognition/android/app/build.gradle b/lite/examples/optical_character_recognition/android/app/build.gradle index 311a2c62493..12686db8fed 100644 --- a/lite/examples/optical_character_recognition/android/app/build.gradle +++ b/lite/examples/optical_character_recognition/android/app/build.gradle @@ -20,12 +20,17 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 29 - buildToolsVersion "29.0.2" + buildFeatures { + viewBinding = true + } + compileSdk 34 + namespace = "org.tensorflow.lite.examples.ocr" + testNamespace = "org.tensorflow.lite.examples.ocr.test" defaultConfig { applicationId "org.tensorflow.lite.examples.ocr" minSdkVersion 21 - targetSdkVersion 29 + multiDexEnabled true + targetSdkVersion 34 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -86,3 +91,4 @@ dependencies { implementation 'com.quickbirdstudios:opencv:4.5.3.0' } + diff --git a/lite/examples/optical_character_recognition/android/app/src/main/AndroidManifest.xml b/lite/examples/optical_character_recognition/android/app/src/main/AndroidManifest.xml index de4dfb5906e..131b51fda94 100644 --- a/lite/examples/optical_character_recognition/android/app/src/main/AndroidManifest.xml +++ b/lite/examples/optical_character_recognition/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml b/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml index ac3c9655071..93ea92f0565 100644 --- a/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml +++ b/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml @@ -64,7 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tfe_using_first_image" /> - + + - diff --git a/lite/examples/optical_character_recognition/android/build.gradle b/lite/examples/optical_character_recognition/android/build.gradle index cec5c39130a..3af1cbf3d36 100644 --- a/lite/examples/optical_character_recognition/android/build.gradle +++ b/lite/examples/optical_character_recognition/android/build.gradle @@ -16,15 +16,20 @@ limitations under the License. // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.30-M1' + ext { + + agp_version1 = '8.1.4' + agp_version = '8.1.4' + } + ext.kotlin_version = '1.6.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.0' + classpath "com.android.tools.build:gradle:$agp_version1" classpath 'de.undercouch:gradle-download-task:4.0.2' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/lite/examples/optical_character_recognition/android/gradle.properties b/lite/examples/optical_character_recognition/android/gradle.properties index 52f5917cb0d..193a5b26e77 100644 --- a/lite/examples/optical_character_recognition/android/gradle.properties +++ b/lite/examples/optical_character_recognition/android/gradle.properties @@ -16,4 +16,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/lite/examples/optical_character_recognition/android/gradle/wrapper/gradle-wrapper.properties b/lite/examples/optical_character_recognition/android/gradle/wrapper/gradle-wrapper.properties index 3fa8f862f75..1dd0aee860f 100644 --- a/lite/examples/optical_character_recognition/android/gradle/wrapper/gradle-wrapper.properties +++ b/lite/examples/optical_character_recognition/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Wed Nov 22 03:33:34 EST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 18a63666d364382ac594af59d279a1523ea37878 Mon Sep 17 00:00:00 2001 From: Amey Bansod Date: Wed, 22 Nov 2023 04:01:14 -0500 Subject: [PATCH 2/2] UI updated --- .../android/app/src/main/res/layout/tfe_is_activity_main.xml | 4 ++-- .../android/app/src/main/res/values/dimens.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml b/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml index 93ea92f0565..d54076bd477 100644 --- a/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml +++ b/lite/examples/optical_character_recognition/android/app/src/main/res/layout/tfe_is_activity_main.xml @@ -64,7 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tfe_using_first_image" /> - + - + diff --git a/lite/examples/optical_character_recognition/android/app/src/main/res/values/dimens.xml b/lite/examples/optical_character_recognition/android/app/src/main/res/values/dimens.xml index fda292b137c..33ab84aee66 100644 --- a/lite/examples/optical_character_recognition/android/app/src/main/res/values/dimens.xml +++ b/lite/examples/optical_character_recognition/android/app/src/main/res/values/dimens.xml @@ -1,6 +1,6 @@ - 250dp + 150dp 15dp 8dp