From 3e270dd7f59633d26f036345c759425e743efcd2 Mon Sep 17 00:00:00 2001 From: Natan Date: Tue, 4 Apr 2023 15:29:49 -0300 Subject: [PATCH] update project/gradle --- app/build.gradle | 30 ++++++++++++------- app/src/main/AndroidManifest.xml | 5 ++-- .../com/sample/localaar/demo/MainActivity.kt | 14 +++++---- build.gradle | 9 +++--- gradle/library.gradle | 11 ++++--- gradle/local-aar.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2f956ef..a5df54c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,15 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply from: "$rootDir/gradle/local-aar.gradle" android { - compileSdkVersion 28 + namespace "com.sample.localaar.demo" + + compileSdk 33 defaultConfig { applicationId "com.sample.localaar.demo" - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion 21 + targetSdkVersion 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -19,18 +20,27 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + buildFeatures { + viewBinding = true + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.core:core-ktx:1.0.2' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation customModulePath(':myawesomemodule1') implementation customModulePath(':myawesomemodule2') implementation customModulePath(':myawesomemodule3') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f70c4ff..35de7fe 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/app/src/main/java/com/sample/localaar/demo/MainActivity.kt b/app/src/main/java/com/sample/localaar/demo/MainActivity.kt index d638d8d..b1f2369 100644 --- a/app/src/main/java/com/sample/localaar/demo/MainActivity.kt +++ b/app/src/main/java/com/sample/localaar/demo/MainActivity.kt @@ -2,18 +2,22 @@ package com.sample.localaar.demo import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import com.sample.localaar.demo.databinding.ActivityMainBinding import com.sample.localaar.myawesomemodule1.AwesomeModule1 import com.sample.localaar.myawesomemodule2.AwesomeModule2 import com.sample.localaar.myawesomemodule3.AwesomeModule3 -import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { + lateinit var binding: ActivityMainBinding + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - textView2.text= AwesomeModule1.greet - textView3.text= AwesomeModule2.greet - textView4.text= AwesomeModule3.greet + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + + binding.textView2.text = AwesomeModule1.greet + binding.textView3.text = AwesomeModule2.greet + binding.textView4.text = AwesomeModule3.greet } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index d0ed544..dedd767 100644 --- a/build.gradle +++ b/build.gradle @@ -3,14 +3,13 @@ apply from: "$rootDir/gradle/local-aar-config.gradle" apply from: "$rootDir/gradle/local-aar.gradle" buildscript { - ext.kotlin_version = '1.3.31' + ext.kotlin_version = '1.8.10' repositories { google() - jcenter() - + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.2' + classpath 'com.android.tools.build:gradle:7.3.1' 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 @@ -23,7 +22,7 @@ allprojects { url = "$rootDir/localMavenRepository" } google() - jcenter() + mavenCentral() } } diff --git a/gradle/library.gradle b/gradle/library.gradle index 7f02df6..d22b4ea 100644 --- a/gradle/library.gradle +++ b/gradle/library.gradle @@ -4,11 +4,10 @@ apply from: "$rootDir/gradle/publish.gradle" android { - compileSdkVersion 28 - + compileSdkVersion 33 defaultConfig { - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion 21 + targetSdkVersion 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -21,6 +20,10 @@ android { } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } } dependencies { diff --git a/gradle/local-aar.gradle b/gradle/local-aar.gradle index 3e8ea7b..c1dd4a6 100644 --- a/gradle/local-aar.gradle +++ b/gradle/local-aar.gradle @@ -12,7 +12,7 @@ configurations.all { resolutionStrategy.dependencySubstitution { if (useAARForDevBuild) { inDevModules.each { moduleName -> - substitute module("${localAARPublishConfig.groupId}$moduleName:${localAARPublishConfig.version}") with project(moduleName) + substitute module("${localAARPublishConfig.groupId}$moduleName:${localAARPublishConfig.version}") using project(moduleName) } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6bea867..e5f7b23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip