Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.BaseExtension
import com.google.samples.apps.nowinandroid.configureBadgingTasks
import com.google.samples.apps.nowinandroid.configureGradleManagedDevices
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
Expand All @@ -25,7 +24,6 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType

class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
Expand All @@ -44,7 +42,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
}
extensions.configure<ApplicationAndroidComponentsExtension> {
configurePrintApksTask(this)
configureBadgingTasks(extensions.getByType<BaseExtension>(), this)
configureBadgingTasks(this)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package com.google.samples.apps.nowinandroid

import com.android.SdkConstants
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.BaseExtension
import com.google.common.truth.Truth.assertWithMessage
import org.gradle.api.DefaultTask
import org.gradle.api.Project
Expand Down Expand Up @@ -110,7 +108,6 @@ private fun String.capitalized() = replaceFirstChar {
}

fun Project.configureBadgingTasks(
baseExtension: BaseExtension,
componentsExtension: ApplicationAndroidComponentsExtension,
) {
// Registers a callback to be called, when a new variant is configured
Expand All @@ -122,14 +119,8 @@ fun Project.configureBadgingTasks(
tasks.register<GenerateBadgingTask>(generateBadgingTaskName) {
apk = variant.artifacts.get(SingleArtifact.APK_FROM_BUNDLE)
aapt2Executable.set(
// TODO: Replace with `sdkComponents.aapt2` when it's available in AGP
// https://issuetracker.google.com/issues/376815836
componentsExtension.sdkComponents.sdkDirectory.map { directory ->
directory.file(
"${SdkConstants.FD_BUILD_TOOLS}/" +
"${baseExtension.buildToolsVersion}/" +
SdkConstants.FN_AAPT2,
)
componentsExtension.sdkComponents.aapt2.flatMap { aapt2 ->
aapt2.executable
}
)
badging = project.layout.buildDirectory.file(
Expand Down
2 changes: 1 addition & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ val backendUrl = providers.fileContents(

androidComponents {
onVariants {
it.buildConfigFields.put("BACKEND_URL", backendUrl.map { value ->
it.buildConfigFields?.put("BACKEND_URL", backendUrl.map { value ->
BuildConfigField(type = "String", value = """"$value"""", comment = null)
})
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
accompanist = "0.37.0"
androidDesugarJdkLibs = "2.1.4"
# AGP and tools should be updated together
androidGradlePlugin = "8.9.0"
androidTools = "31.9.0"
androidGradlePlugin = "8.10.1"

Check warning

Code scanning / Android Lint

Obsolete Android Gradle Plugin Version Warning

A newer version of com.android.library than 8.10.1 is available: 8.12.1

Check warning

Code scanning / Android Lint

Obsolete Android Gradle Plugin Version Warning

A newer version of com.android.test than 8.10.1 is available: 8.12.1

Check warning

Code scanning / Android Lint

Obsolete Android Gradle Plugin Version Warning

A newer version of com.android.tools.build:gradle than 8.10.1 is available: 8.12.1
androidTools = "31.10.1"
androidxActivity = "1.9.3"
androidxAppCompat = "1.7.0"
androidxBrowser = "1.8.0"
Expand Down
Loading