From ee393021aa30fef1d6fe722db1a8cad16775767b Mon Sep 17 00:00:00 2001 From: EsmaeeilMoradi Date: Wed, 2 Aug 2023 17:09:36 +0330 Subject: [PATCH] Update & Refactor: Update application to API 33, Update AndroidX, Refactor build system --- .idea/compiler.xml | 6 ++ .idea/gradle.xml | 6 +- .idea/kotlinc.xml | 6 ++ ...store_datastore_core_1_0_0_alpha01_aar.xml | 12 ++++ ...ogle_protobuf_protobuf_javalite_3_10_0.xml | 13 ++++ .../android_arch_core_common_1_1_0_jar.xml | 11 ---- .../android_arch_core_runtime_1_1_0.xml | 12 ---- ...ndroid_arch_lifecycle_common_1_1_0_jar.xml | 11 ---- ...oid_arch_lifecycle_livedata_core_1_1_0.xml | 12 ---- .../android_arch_lifecycle_runtime_1_1_0.xml | 12 ---- ...android_arch_lifecycle_viewmodel_1_1_0.xml | 12 ---- ...upport_animated_vector_drawable_27_1_0.xml | 12 ---- ...om_android_support_appcompat_v7_27_1_0.xml | 12 ---- ...ort_constraint_constraint_layout_1_0_2.xml | 10 --- ...int_constraint_layout_solver_1_0_2_jar.xml | 9 --- ...support_support_annotations_27_1_0_jar.xml | 11 ---- ..._android_support_support_compat_27_1_0.xml | 12 ---- ...android_support_support_core_ui_27_1_0.xml | 12 ---- ...roid_support_support_core_utils_27_1_0.xml | 12 ---- ...ndroid_support_support_fragment_27_1_0.xml | 12 ---- ...support_support_vector_drawable_27_1_0.xml | 12 ---- ...port_test_espresso_espresso_core_3_0_1.xml | 12 ---- ...spresso_espresso_idling_resource_3_0_1.xml | 12 ---- .../com_android_support_test_rules_1_0_1.xml | 12 ---- .../com_android_support_test_runner_1_0_1.xml | 12 ---- ..._google_code_findbugs_jsr305_2_0_1_jar.xml | 9 --- ...oogle_protobuf_protobuf_lite_3_0_1_jar.xml | 11 ---- .../com_squareup_javawriter_2_1_1_jar.xml | 13 ---- .../javax_inject_javax_inject_1_jar.xml | 13 ---- .idea/libraries/junit_junit_4_12_jar.xml | 13 ---- .../libraries/net_sf_kxml_kxml2_2_3_0_jar.xml | 9 --- .../org_hamcrest_hamcrest_core_1_3_jar.xml | 13 ---- ..._hamcrest_hamcrest_integration_1_3_jar.xml | 13 ---- .../org_hamcrest_hamcrest_library_1_3_jar.xml | 13 ---- .../org_jetbrains_annotations_13_0_jar.xml | 9 --- ...brains_kotlin_kotlin_stdlib_1_2_30_jar.xml | 11 ---- ...s_kotlin_kotlin_stdlib_jre7_1_2_30_jar.xml | 11 ---- .idea/libraries/protobuf_lite_3_0_1.xml | 11 ---- .idea/misc.xml | 21 ++++++- .idea/modules.xml | 11 +++- .idea/runConfigurations.xml | 12 ---- app/build.gradle | 63 ++++++++++++++----- app/src/main/AndroidManifest.xml | 3 +- .../mohsenoid/protobuftest/MainActivity.kt | 31 ++++----- {protobuf => app}/src/main/proto/sample.proto | 0 app/src/main/res/layout/activity_main.xml | 5 +- build.gradle | 35 ++--------- gradle.properties | 13 +++- gradle/wrapper/gradle-wrapper.properties | 4 +- protobuf/.gitignore | 1 - protobuf/build.gradle | 38 ----------- settings.gradle | 16 ++++- 52 files changed, 168 insertions(+), 509 deletions(-) create mode 100644 .idea/compiler.xml create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/libraries/Gradle__androidx_datastore_datastore_core_1_0_0_alpha01_aar.xml create mode 100644 .idea/libraries/Gradle__com_google_protobuf_protobuf_javalite_3_10_0.xml delete mode 100644 .idea/libraries/android_arch_core_common_1_1_0_jar.xml delete mode 100644 .idea/libraries/android_arch_core_runtime_1_1_0.xml delete mode 100644 .idea/libraries/android_arch_lifecycle_common_1_1_0_jar.xml delete mode 100644 .idea/libraries/android_arch_lifecycle_livedata_core_1_1_0.xml delete mode 100644 .idea/libraries/android_arch_lifecycle_runtime_1_1_0.xml delete mode 100644 .idea/libraries/android_arch_lifecycle_viewmodel_1_1_0.xml delete mode 100644 .idea/libraries/com_android_support_animated_vector_drawable_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_appcompat_v7_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_constraint_constraint_layout_1_0_2.xml delete mode 100644 .idea/libraries/com_android_support_constraint_constraint_layout_solver_1_0_2_jar.xml delete mode 100644 .idea/libraries/com_android_support_support_annotations_27_1_0_jar.xml delete mode 100644 .idea/libraries/com_android_support_support_compat_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_support_core_ui_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_support_core_utils_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_support_fragment_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_support_vector_drawable_27_1_0.xml delete mode 100644 .idea/libraries/com_android_support_test_espresso_espresso_core_3_0_1.xml delete mode 100644 .idea/libraries/com_android_support_test_espresso_espresso_idling_resource_3_0_1.xml delete mode 100644 .idea/libraries/com_android_support_test_rules_1_0_1.xml delete mode 100644 .idea/libraries/com_android_support_test_runner_1_0_1.xml delete mode 100644 .idea/libraries/com_google_code_findbugs_jsr305_2_0_1_jar.xml delete mode 100644 .idea/libraries/com_google_protobuf_protobuf_lite_3_0_1_jar.xml delete mode 100644 .idea/libraries/com_squareup_javawriter_2_1_1_jar.xml delete mode 100644 .idea/libraries/javax_inject_javax_inject_1_jar.xml delete mode 100644 .idea/libraries/junit_junit_4_12_jar.xml delete mode 100644 .idea/libraries/net_sf_kxml_kxml2_2_3_0_jar.xml delete mode 100644 .idea/libraries/org_hamcrest_hamcrest_core_1_3_jar.xml delete mode 100644 .idea/libraries/org_hamcrest_hamcrest_integration_1_3_jar.xml delete mode 100644 .idea/libraries/org_hamcrest_hamcrest_library_1_3_jar.xml delete mode 100644 .idea/libraries/org_jetbrains_annotations_13_0_jar.xml delete mode 100644 .idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_1_2_30_jar.xml delete mode 100644 .idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_jre7_1_2_30_jar.xml delete mode 100644 .idea/libraries/protobuf_lite_3_0_1.xml delete mode 100644 .idea/runConfigurations.xml rename {protobuf => app}/src/main/proto/sample.proto (100%) delete mode 100644 protobuf/.gitignore delete mode 100644 protobuf/build.gradle diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 0beaf02..59ba8b2 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,18 +1,20 @@ + diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..69e8615 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_datastore_datastore_core_1_0_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_datastore_datastore_core_1_0_0_alpha01_aar.xml new file mode 100644 index 0000000..9d879f9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_datastore_datastore_core_1_0_0_alpha01_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_protobuf_protobuf_javalite_3_10_0.xml b/.idea/libraries/Gradle__com_google_protobuf_protobuf_javalite_3_10_0.xml new file mode 100644 index 0000000..0136eda --- /dev/null +++ b/.idea/libraries/Gradle__com_google_protobuf_protobuf_javalite_3_10_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/android_arch_core_common_1_1_0_jar.xml b/.idea/libraries/android_arch_core_common_1_1_0_jar.xml deleted file mode 100644 index 6bf5068..0000000 --- a/.idea/libraries/android_arch_core_common_1_1_0_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/android_arch_core_runtime_1_1_0.xml b/.idea/libraries/android_arch_core_runtime_1_1_0.xml deleted file mode 100644 index 855642e..0000000 --- a/.idea/libraries/android_arch_core_runtime_1_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/android_arch_lifecycle_common_1_1_0_jar.xml b/.idea/libraries/android_arch_lifecycle_common_1_1_0_jar.xml deleted file mode 100644 index e700771..0000000 --- a/.idea/libraries/android_arch_lifecycle_common_1_1_0_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/android_arch_lifecycle_livedata_core_1_1_0.xml b/.idea/libraries/android_arch_lifecycle_livedata_core_1_1_0.xml deleted file mode 100644 index 2a3ae87..0000000 --- a/.idea/libraries/android_arch_lifecycle_livedata_core_1_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/android_arch_lifecycle_runtime_1_1_0.xml b/.idea/libraries/android_arch_lifecycle_runtime_1_1_0.xml deleted file mode 100644 index 53bc94c..0000000 --- a/.idea/libraries/android_arch_lifecycle_runtime_1_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/android_arch_lifecycle_viewmodel_1_1_0.xml b/.idea/libraries/android_arch_lifecycle_viewmodel_1_1_0.xml deleted file mode 100644 index a4851b0..0000000 --- a/.idea/libraries/android_arch_lifecycle_viewmodel_1_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_animated_vector_drawable_27_1_0.xml b/.idea/libraries/com_android_support_animated_vector_drawable_27_1_0.xml deleted file mode 100644 index 79a47d6..0000000 --- a/.idea/libraries/com_android_support_animated_vector_drawable_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_appcompat_v7_27_1_0.xml b/.idea/libraries/com_android_support_appcompat_v7_27_1_0.xml deleted file mode 100644 index de58963..0000000 --- a/.idea/libraries/com_android_support_appcompat_v7_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_constraint_constraint_layout_1_0_2.xml b/.idea/libraries/com_android_support_constraint_constraint_layout_1_0_2.xml deleted file mode 100644 index 1f03c6f..0000000 --- a/.idea/libraries/com_android_support_constraint_constraint_layout_1_0_2.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_constraint_constraint_layout_solver_1_0_2_jar.xml b/.idea/libraries/com_android_support_constraint_constraint_layout_solver_1_0_2_jar.xml deleted file mode 100644 index 2e7dc57..0000000 --- a/.idea/libraries/com_android_support_constraint_constraint_layout_solver_1_0_2_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_annotations_27_1_0_jar.xml b/.idea/libraries/com_android_support_support_annotations_27_1_0_jar.xml deleted file mode 100644 index 681cdc2..0000000 --- a/.idea/libraries/com_android_support_support_annotations_27_1_0_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_compat_27_1_0.xml b/.idea/libraries/com_android_support_support_compat_27_1_0.xml deleted file mode 100644 index 9559019..0000000 --- a/.idea/libraries/com_android_support_support_compat_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_core_ui_27_1_0.xml b/.idea/libraries/com_android_support_support_core_ui_27_1_0.xml deleted file mode 100644 index 58ec9d3..0000000 --- a/.idea/libraries/com_android_support_support_core_ui_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_core_utils_27_1_0.xml b/.idea/libraries/com_android_support_support_core_utils_27_1_0.xml deleted file mode 100644 index df21a25..0000000 --- a/.idea/libraries/com_android_support_support_core_utils_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_fragment_27_1_0.xml b/.idea/libraries/com_android_support_support_fragment_27_1_0.xml deleted file mode 100644 index 82e154d..0000000 --- a/.idea/libraries/com_android_support_support_fragment_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_support_vector_drawable_27_1_0.xml b/.idea/libraries/com_android_support_support_vector_drawable_27_1_0.xml deleted file mode 100644 index cf43b7d..0000000 --- a/.idea/libraries/com_android_support_support_vector_drawable_27_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_test_espresso_espresso_core_3_0_1.xml b/.idea/libraries/com_android_support_test_espresso_espresso_core_3_0_1.xml deleted file mode 100644 index 8248488..0000000 --- a/.idea/libraries/com_android_support_test_espresso_espresso_core_3_0_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_test_espresso_espresso_idling_resource_3_0_1.xml b/.idea/libraries/com_android_support_test_espresso_espresso_idling_resource_3_0_1.xml deleted file mode 100644 index 60b7fa9..0000000 --- a/.idea/libraries/com_android_support_test_espresso_espresso_idling_resource_3_0_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_test_rules_1_0_1.xml b/.idea/libraries/com_android_support_test_rules_1_0_1.xml deleted file mode 100644 index 78dde34..0000000 --- a/.idea/libraries/com_android_support_test_rules_1_0_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_android_support_test_runner_1_0_1.xml b/.idea/libraries/com_android_support_test_runner_1_0_1.xml deleted file mode 100644 index f28ba0f..0000000 --- a/.idea/libraries/com_android_support_test_runner_1_0_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_google_code_findbugs_jsr305_2_0_1_jar.xml b/.idea/libraries/com_google_code_findbugs_jsr305_2_0_1_jar.xml deleted file mode 100644 index 6343119..0000000 --- a/.idea/libraries/com_google_code_findbugs_jsr305_2_0_1_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_google_protobuf_protobuf_lite_3_0_1_jar.xml b/.idea/libraries/com_google_protobuf_protobuf_lite_3_0_1_jar.xml deleted file mode 100644 index 6423330..0000000 --- a/.idea/libraries/com_google_protobuf_protobuf_lite_3_0_1_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/com_squareup_javawriter_2_1_1_jar.xml b/.idea/libraries/com_squareup_javawriter_2_1_1_jar.xml deleted file mode 100644 index 8799a8b..0000000 --- a/.idea/libraries/com_squareup_javawriter_2_1_1_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/javax_inject_javax_inject_1_jar.xml b/.idea/libraries/javax_inject_javax_inject_1_jar.xml deleted file mode 100644 index 3872721..0000000 --- a/.idea/libraries/javax_inject_javax_inject_1_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/junit_junit_4_12_jar.xml b/.idea/libraries/junit_junit_4_12_jar.xml deleted file mode 100644 index 6b24265..0000000 --- a/.idea/libraries/junit_junit_4_12_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/net_sf_kxml_kxml2_2_3_0_jar.xml b/.idea/libraries/net_sf_kxml_kxml2_2_3_0_jar.xml deleted file mode 100644 index ee85b61..0000000 --- a/.idea/libraries/net_sf_kxml_kxml2_2_3_0_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_hamcrest_hamcrest_core_1_3_jar.xml b/.idea/libraries/org_hamcrest_hamcrest_core_1_3_jar.xml deleted file mode 100644 index c94a825..0000000 --- a/.idea/libraries/org_hamcrest_hamcrest_core_1_3_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_hamcrest_hamcrest_integration_1_3_jar.xml b/.idea/libraries/org_hamcrest_hamcrest_integration_1_3_jar.xml deleted file mode 100644 index 5e7b9b9..0000000 --- a/.idea/libraries/org_hamcrest_hamcrest_integration_1_3_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_hamcrest_hamcrest_library_1_3_jar.xml b/.idea/libraries/org_hamcrest_hamcrest_library_1_3_jar.xml deleted file mode 100644 index 79e5b7e..0000000 --- a/.idea/libraries/org_hamcrest_hamcrest_library_1_3_jar.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_jetbrains_annotations_13_0_jar.xml b/.idea/libraries/org_jetbrains_annotations_13_0_jar.xml deleted file mode 100644 index 321d813..0000000 --- a/.idea/libraries/org_jetbrains_annotations_13_0_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_1_2_30_jar.xml b/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_1_2_30_jar.xml deleted file mode 100644 index 3ed7a1f..0000000 --- a/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_1_2_30_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_jre7_1_2_30_jar.xml b/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_jre7_1_2_30_jar.xml deleted file mode 100644 index 19e2507..0000000 --- a/.idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_jre7_1_2_30_jar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/protobuf_lite_3_0_1.xml b/.idea/libraries/protobuf_lite_3_0_1.xml deleted file mode 100644 index 69020d6..0000000 --- a/.idea/libraries/protobuf_lite_3_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3963879..03528b3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,26 +5,41 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index 8b5d575..b18d62f 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,9 +2,14 @@ - - - + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1fec90d..30f7711 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,17 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' + id 'com.google.protobuf' +} android { - compileSdkVersion 27 + namespace 'com.mohsenoid.protobuftest' + compileSdkVersion 33 defaultConfig { applicationId "com.mohsenoid.protobuftest" minSdkVersion 18 - targetSdkVersion 27 + targetSdkVersion 33 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -21,21 +24,47 @@ android { } } - sourceSets { - main.java.srcDirs += 'src/main/kotlin/' - test.java.srcDirs += 'src/test/kotlin/' - androidTest.java.srcDirs += 'src/androidTest/kotlin/' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation project(':protobuf') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" - implementation 'com.android.support:appcompat-v7:27.1.0' - implementation 'com.android.support.constraint:constraint-layout:1.0.2' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' - implementation 'com.google.protobuf:protobuf-lite:3.0.1' + + implementation 'androidx.core:core-ktx:1.10.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + + + // Proto DataStore + implementation "androidx.datastore:datastore-core:1.0.0-alpha01" + implementation "com.google.protobuf:protobuf-javalite:3.10.0" } +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:3.10.0" + } + + // Generates the java Protobuf-lite code for the Protobufs in this project. See + // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation + // for more information. + generateProtoTasks { + all().each { task -> + task.builtins { + java { + option 'lite' + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cecf091..e67c6a7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/kotlin/com/mohsenoid/protobuftest/MainActivity.kt b/app/src/main/kotlin/com/mohsenoid/protobuftest/MainActivity.kt index 2311ed6..58b55cd 100644 --- a/app/src/main/kotlin/com/mohsenoid/protobuftest/MainActivity.kt +++ b/app/src/main/kotlin/com/mohsenoid/protobuftest/MainActivity.kt @@ -1,7 +1,8 @@ package com.mohsenoid.protobuftest import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity + class MainActivity : AppCompatActivity() { @@ -25,31 +26,31 @@ class MainActivity : AppCompatActivity() { private fun createAddressBookProtobuf(): AddressBookProtos.AddressBook { // building PhoneNumber objects val phoneHome = AddressBookProtos.Person.PhoneNumber.newBuilder() - .setNumber("+49123456") - .setType(AddressBookProtos.Person.PhoneType.HOME) - .build() + .setNumber("+49123456") + .setType(AddressBookProtos.Person.PhoneType.HOME) + .build() val phoneMobile = AddressBookProtos.Person.PhoneNumber.newBuilder() - .setNumber("+49654321") - .setType(AddressBookProtos.Person.PhoneType.MOBILE) - .build() + .setNumber("+49654321") + .setType(AddressBookProtos.Person.PhoneType.MOBILE) + .build() // building a Person object using phone data val person = AddressBookProtos.Person.newBuilder() - .setId(1) - .setName("Mohsen") - .setEmail("info@mohsenoid.com") - .addAllPhones(listOf(phoneHome, phoneMobile)) - .build() + .setId(1) + .setName("Mohsen") + .setEmail("info@mohsenoid.com") + .addAllPhones(listOf(phoneHome, phoneMobile)) + .build() // building an AddressBook object using person data return AddressBookProtos.AddressBook.newBuilder() - .addAllPeople(listOf(person)) - .build() + .addAllPeople(listOf(person)) + .build() } companion object { private const val SAMPLE_JSON = - """{ + """{ "addressbook": [ { "person": { diff --git a/protobuf/src/main/proto/sample.proto b/app/src/main/proto/sample.proto similarity index 100% rename from protobuf/src/main/proto/sample.proto rename to app/src/main/proto/sample.proto diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index de28a7a..e2edaaf 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,6 @@ - - + diff --git a/build.gradle b/build.gradle index c46c821..b608f7c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,30 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext.kotlin_version = '1.2.30' - ext.protobufVersion = '0.8.3' - - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufVersion" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} +plugins { + id 'com.android.application' version '8.0.1' apply false + id 'com.android.library' version '8.0.1' apply false + id 'org.jetbrains.kotlin.android' version '1.8.20' apply false + id 'com.google.protobuf' version '0.9.1' apply false +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index aac7c9b..7651b25 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,9 +9,18 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m - +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e874681..c8883b3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Dec 23 10:09:05 CET 2017 +#Tue Aug 01 18:35:23 IRST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/protobuf/.gitignore b/protobuf/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/protobuf/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/protobuf/build.gradle b/protobuf/build.gradle deleted file mode 100644 index 612a30f..0000000 --- a/protobuf/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -apply plugin: 'java-library' -apply plugin: 'com.google.protobuf' - -sourceSets { - main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite" -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.google.protobuf:protobuf-lite:3.0.1' -} - -protobuf { - protoc { - // You still need protoc like in the non-Android case - artifact = 'com.google.protobuf:protoc:3.0.0' - } - - plugins { - javalite { - // The codegen for lite comes as a separate artifact - artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0' - } - } - - generateProtoTasks { - all().each { task -> - task.builtins { - // In most cases you don't need the full Java output - // if you use the lite output. - remove java - } - task.plugins { - javalite {} - } - } - } -} diff --git a/settings.gradle b/settings.gradle index 161084e..b87d5ff 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,15 @@ -include ':app', ':protobuf' \ No newline at end of file +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +include ':app'