Fix INSTALL_FAILED_DEPRECATED_SDK_VERSION on API 28+ for leakcanary-android tests

Android 9 (API 28) and above refuse to install APKs that target
SDK version < 23. The leakcanary-android module was missing an explicit
targetSdk in its defaultConfig, causing the test APK to default to
targetSdkVersion = minSdkVersion = 14.

leakcanary-android-core already had this fix with an explanatory comment.
Apply the same to leakcanary-android so it can run on API 28-34 emulators.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Pierre-Yves Ricau
2026-02-26 17:12:47 +01:00
parent d42b3b575f
commit b79e8a9076

View File

@@ -23,6 +23,8 @@ android {
compileSdk = libs.versions.androidCompileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.androidMinSdk.get().toInt()
// Avoid DeprecatedTargetSdkVersionDialog / INSTALL_FAILED_DEPRECATED_SDK_VERSION on API 28+
targetSdk = libs.versions.androidCompileSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures.buildConfig = false