Skip to content

Commit

Permalink
Make project compatible with Gradle 8.x and Android Gradle Plugin 8.x
Browse files Browse the repository at this point in the history
Those changes required if you want too use project as included build for an app which already uses AGP 8. So it allows to debug or experiment with Amplitude SDK as part of your own project

- Update Kotlin 1.9.0 and AGP 8.1.0, Gradle 8.2.1
- Removed fat-aar because it's not compatible with AGP 8 (see kezong/fat-aar-android#409), so no dependencies packaging into single AAR anymore, it affects publishing, but doesn't affect if repo used as included build
- Fix incompatibility with AGP 8 DSL: added namepaces, enabled required buildFeatures
  • Loading branch information
gildor committed Aug 23, 2023
1 parent 1d44778 commit 891cc69
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
15 changes: 8 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'com.kezong.fat-aar'
}

ext {
Expand All @@ -17,6 +16,8 @@ version = PUBLISH_VERSION

android {
compileSdk 31
buildFeatures.buildConfig = true
namespace = "com.amplitude.android"

defaultConfig {
multiDexEnabled true
Expand Down Expand Up @@ -52,12 +53,12 @@ android {
}

dependencies {
embed project(':common')
embed project(':common-jvm')
embed project(':common-android')
embed project(':core')
embed project(':event-bridge')
embed project(':id')
implementation project(':common')
implementation project(':common-jvm')
implementation project(':common-android')
implementation project(':core')
implementation project(':event-bridge')
implementation project(':id')
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
implementation 'com.amplitude:analytics-connector:1.0.0'
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = "1.5.10"
ext.kotlin_version = "1.9.0"
ext.dokka_version = '1.6.10'
repositories {
maven { url "https://plugins.gradle.org/m2/" }
Expand All @@ -8,13 +8,12 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.1"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1"
classpath 'com.github.kezong:fat-aar:1.3.8'
}
}

Expand Down
1 change: 1 addition & 0 deletions common-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
}

android {
namespace = "com.amplitude.common.android"
compileSdk 31

defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions samples/java-android-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ext {
}

android {
namespace = "com.amplitude.android.sample"
compileSdk 31
buildFeatures.buildConfig = true

defaultConfig {
applicationId "com.amplitude.android.sample"
Expand Down
2 changes: 2 additions & 0 deletions samples/kotlin-android-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ ext {
}

android {
namespace = "com.amplitude.android.sample"
compileSdk 31
buildFeatures.buildConfig = true

defaultConfig {
applicationId "com.amplitude.android.sample"
Expand Down

0 comments on commit 891cc69

Please sign in to comment.