From 30f563367fe374c135a0d9d82096f20a7e78992d Mon Sep 17 00:00:00 2001 From: Sneha Canopas Date: Tue, 3 Dec 2024 16:04:32 +0530 Subject: [PATCH] Fix android build --- .github/workflows/android_build.yml | 2 - android/app/build.gradle | 38 ++++--------------- android/app/src/debug/AndroidManifest.xml | 3 +- android/app/src/main/AndroidManifest.xml | 5 +-- .../com/canopas/projectunity/MainActivity.kt | 6 --- .../kotlin/com/canopas/unity/MainActivity.kt | 6 --- android/app/src/profile/AndroidManifest.xml | 3 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 4 +- lib/ui/sign_in/bloc/sign_in_view_bloc.dart | 2 +- 10 files changed, 16 insertions(+), 55 deletions(-) delete mode 100644 android/app/src/main/kotlin/com/canopas/projectunity/MainActivity.kt delete mode 100644 android/app/src/main/kotlin/com/canopas/unity/MainActivity.kt diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index a9d2c41bc..d6a4919e4 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -2,8 +2,6 @@ name: Android Build on: push: - branches: - - main workflow_dispatch: jobs: diff --git a/android/app/build.gradle b/android/app/build.gradle index c42208bfe..748b136eb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,35 +2,13 @@ plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" - id "com.google.gms.google-services" - id "com.google.firebase.crashlytics" } - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - - - - android { compileSdkVersion 34//flutter.compileSdkVersion + namespace = "com.example.canopas_unity" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -38,7 +16,7 @@ android { } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_1_8 } sourceSets { @@ -48,10 +26,10 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.canopas.projectunity" - minSdkVersion 21 - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdkVersion 34 + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "ProjectUnity-${variant.name}-${versionName}-${versionCode}.apk" diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 934fc2b33..f880684a6 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index fe30fae21..1d396a7c4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + - + diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3556a8496..74777a880 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Apr 26 12:42:38 IST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/android/settings.gradle b/android/settings.gradle index 5046f4aac..2047f3c8f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -18,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.0.4" apply false - id "org.jetbrains.kotlin.android" version "1.8.21" apply false + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false id "com.google.gms.google-services" version "4.3.10" apply false id "com.google.firebase.crashlytics" version "2.9.9" apply false diff --git a/lib/ui/sign_in/bloc/sign_in_view_bloc.dart b/lib/ui/sign_in/bloc/sign_in_view_bloc.dart index f105dd0c8..5f691dc9d 100644 --- a/lib/ui/sign_in/bloc/sign_in_view_bloc.dart +++ b/lib/ui/sign_in/bloc/sign_in_view_bloc.dart @@ -39,7 +39,7 @@ class SignInBloc extends Bloc { } else { emit(state.copyWith(googleSignInLoading: false)); } - } on Exception { + } catch(e) { emit(state.copyWith( googleSignInLoading: false, error: firesbaseAuthError)); }