Conversation
…ary modules
Library modules have no production targetSdk - AGP removed it because the
consuming app's targetSdk governs - and their merged manifests carry only
minSdkVersion. These six lines therefore only ever affected instrumented-test
manifests, and six other Android modules (aggregates, commonskmm,
dhis2-mobile-program-rules, login, sync, tracker) already omit the property,
so the codebase was inconsistent.
They were also written inside defaultConfig { } while actually setting
android.testOptions.targetSdk through the enclosing android { } scope, which
read as though library modules had a defaultConfig targetSdk.
Removing them lets the value fall back to AGP's default, which follows
compileSdk. Verified behaviour-neutral here: form's debugAndroidTest manifest
still resolves to targetSdkVersion=36.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
andresmr
force-pushed
the
chore/remove-library-testoptions-targetsdk
branch
from
August 7, 2026 14:23
f844088 to
01b7740
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Jira: ANDROAPP-7745
Why
Six library modules set
testOptions.targetSdkinside theirdefaultConfigblock:defaultConfig { minSdk = libs.versions.minSdk.get().toInt() testOptions.targetSdk = libs.versions.sdk.get().toInt() // not a defaultConfig propertyTwo problems with that.
It isn't a
defaultConfigproperty. It resolves toandroid.testOptions.targetSdkthrough the enclosingandroid { }scope, so the code reads as though library modules have adefaultConfigtargetSdk. They don't — AGP removed it because the consuming app'stargetSdkgoverns. Confirmed: the library merged manifests carry onlyandroid:minSdkVersion="23", notargetSdkVersionat all. It dates from1f5681b35("Update gradle and kotlin version"), so it looks like a mechanical fix when AGP deprecateddefaultConfig.targetSdkfor libraries.It's redundant and inconsistent. The property only ever reaches instrumented-test manifests — across the whole build output it materialises in exactly one file,
form/build/intermediates/packaged_manifests/debugAndroidTest/.../AndroidManifest.xml. Nothing shipped is affected. And six other Android modules already omit it entirely and build and test fine:aggregates,commonskmm,dhis2-mobile-program-rules,login,sync,tracker.Behaviour
Removing the property lets the value fall back to AGP's default, which follows
compileSdk.On
developthat is a genuine no-op, becausecompileSdkandtargetSdkare both 36 — verified by rebuilding and re-reading the manifest, which still resolves totargetSdkVersion="36".Note
This stops being a no-op once #5019 lands. That PR splits
compileSdk(37) fromtargetSdk(36), so instrumented-testtargetSdkwould then followcompileSdkand read 37 rather than 36. Onlyformandcommonshave instrumented tests, so the blast radius is small — but it's a real consequence and reviewers should decide whether they're happy with instrumented tests running at the compile level. If not, the alternative is to keep the property and merely move it out ofdefaultConfiginto a propertestOptions { }block.Verification
./gradlew ktlintCheck✅./gradlew testDebugUnitTest testDhis2DebugUnitTest testAndroidHostTest✅./gradlew :app:assembleDhis2Debug :app:assembleDhis2DebugAndroidTest :form:assembleAndroidTest✅ — thebuild-test-apkstask list, included deliberately because this change affects androidTest manifestsform'sdebugAndroidTestmanifest still resolves totargetSdkVersion="36"✅6 files, 6 deletions, one line each.