Skip to content

[PR-27228] Upgrade Demo App target to Android 17 (API 37) - #16

Merged
dgtv merged 4 commits into
masterfrom
upgrade-api-37
Aug 12, 2026
Merged

[PR-27228] Upgrade Demo App target to Android 17 (API 37)#16
dgtv merged 4 commits into
masterfrom
upgrade-api-37

Conversation

@dgtv

@dgtv dgtv commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Why

Google Play requires apps to target API 36+ by Aug 31, 2026 (target API level policy). This PR targets API 37 (Android 17, the latest stable release) instead of the minimum 36, so the app also clears the next annual deadline without another bump.

What changed

The actual requirement (app module only):

  • app_target_sdk / app_compile_sdk: 35 → 37; app_version_code 3 → 4, versionName 1.0.1

SDK library — public contract unchanged: compileSdk/targetSdk 35, minSdk 16, version 0.5.14. The Play policy applies only to the uploaded app binary, and the SDK keeps its documented Android 4.1+ support, so no SDK release is part of this PR.

Toolchain cascade forced by compileSdk 37 (per the AGP compatibility table it needs AGP ≥ 9.1.1):

  • AGP 8.5.2 → 9.3.0, Gradle 8.7 → 9.5.0, build-tools 37.0.0, unmock plugin 0.7.8 → 0.11.0
  • Groovy DSL migration in both modules: AGP 9 removed compileSdkVersion/minSdkVersion/targetSdkVersion; = assignments replace the space syntax Gradle 10 removes; library targetSdk moved to testOptions (AGP 9 requirement)
  • buildFeatures { buildConfig = true } in sdk replaces the removed android.defaults.buildfeatures.buildconfig flag; dropped android.enableJetifier (all deps are AndroidX)
  • CircleCI image → cimg/android:2026.07.1 (JDK 21, SDK 37 preinstalled); removed-in-AGP-9 androidDependencies task replaced with :sdk:dependencies :app:dependencies
  • proguard-android-optimize.txt replaces proguard-android.txt in both modules — AGP 9 rejects the old default file (inert while minifyEnabled = false)
  • Test-only: PowerMock 1.6.6/Mockito 1.10.19 → PowerMock 2.0.9/Mockito 2.28.2 plus --add-opens test JVM args — the old stack cannot run on JDK 17+ (broken since CI dropped the Java 8 pin); full :sdk:test passes on JDK 21 with this toolchain
  • New jitpack.yml pinning JDK 17 — JitPack's default JDK 8 can't run Gradle 9, which would have broken the next tagged release build

Draft until

  • CI passes on this PR (build + :sdk:test verified locally on JDK 21 / Gradle 9.5 / AGP 9.3 / SDK 37)
  • Android Studio sync (requires Studio Panda 3+ for API 37)
  • Demo app pass on Android 17 — note targeting 36+ makes edge-to-edge mandatory, so check for UI drawing under system bars

Google Play requires target API >= 36 by Aug 31, 2026. Target 37 (latest
stable, June 2026) so the app also clears the Aug 2027 deadline.

App module only: compileSdk/targetSdk 35 -> 37, versionCode 4. The SDK
library's public contract is unchanged (compileSdk 35, minSdk 16, v0.5.14)
since the Play policy applies only to the uploaded app binary.

Toolchain cascade required by compileSdk 37: AGP 8.5.2 -> 9.3.0, Gradle
8.7 -> 9.5.0, build-tools 37.0.0, unmock 0.7.8 -> 0.11.0, Groovy DSL
migration (AGP 9 removed the old names; '=' assignment replaces the
Gradle-10-removed space syntax), buildFeatures.buildConfig replaces the
removed gradle.properties flag, CI image bump, jitpack.yml pins JDK 17
so JitPack tag builds survive Gradle 9.
@dgtv
dgtv requested a review from zhuravel August 7, 2026 03:30
- AGP 9 rejects getDefaultProguardFile('proguard-android.txt'); switch
  both modules to proguard-android-optimize.txt (inert while
  minifyEnabled = false).
- SDK unit tests: PowerMock 1.6.6/Mockito 1.10.19 cannot run on
  JDK 17+ (module encapsulation), broken since CI dropped the Java 8
  pin. Upgrade to PowerMock 2.0.9 / Mockito 2.28.2 (test-only deps)
  and open the JDK modules the mocking stack and OkHttp reflect into.
  Full :sdk:test suite passes on JDK 21 with Gradle 9.5/AGP 9.3.

@zhuravel zhuravel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete PR-only diff against master at e0b9c1f. The AGP/Gradle migration and focused builds pass, but the target-SDK bump activates one material Back-navigation regression in the Talkable offer flow. Requesting the inline fix before merge.

Comment thread gradle.properties
app_compile_sdk=35
app_target_sdk=35
app_compile_sdk=37
app_target_sdk=37

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Migrate custom Back handling before targeting 37

Plain English

On Android 16 and newer, pressing Back while a Talkable popup is open skips the popup-closing behavior and leaves the offer screen instead.

Example

Run the demo on Android 16 or 17, open a Talkable offer and then an in-offer popup, and press system Back. This line raises the app target from 35 to 37, so the platform no longer dispatches TalkableActivity.onBackPressed(). As a result, TalkableOfferFragment.onBackPressed() never publishes close_popups, and the activity follows the default Back action. Android documents this target-36+ change here: behavior changes.

Why this matters

The demo now activates this behavior, and SDK consumers targeting 36 or newer encounter the same broken popup interaction.

Suggested fix

Migrate TalkableActivity to OnBackPressedDispatcher / OnBackPressedCallback and ensure the resolved AndroidX Activity version integrates with predictive Back. For example:

getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
    @Override
    public void handleOnBackPressed() {
        if (!mTalkableOfferFragment.onBackPressed()) {
            finish();
        }
    }
});

Add an Android 16+ device or instrumentation test that opens a popup and verifies that the first Back action closes it. A manifest opt-out is only a temporary fallback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — confirmed: TalkableActivity's Back override stops being dispatched once the app targets 36+. Fixed for the demo app in 372e8a6 with the documented enableOnBackInvokedCallback="false" opt-out. The proper OnBackPressedDispatcher migration needs androidx.activity ≥ 1.6.0 in the SDK (the dispatcher only integrates with predictive back from 1.6.0), so it comes with an AndroidX bump and an SDK release — tracked as a follow-up rather than in this PR, which intentionally doesn't change the published SDK.

Targeting API 36+ enables predictive back by default: onBackPressed()
is no longer dispatched, so TalkableActivity's popup-closing Back
override stops working. Opt out at the application level per
https://developer.android.com/about/versions/16/behavior-changes-16#predictive-back
until the SDK migrates to OnBackPressedDispatcher (requires
androidx.activity >= 1.6.0 and an SDK release; tracked separately).
@dgtv
dgtv marked this pull request as ready for review August 10, 2026 18:06
@dgtv
dgtv requested a review from zhuravel August 12, 2026 01:58

@zhuravel zhuravel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 problem blocks this PR.

Reviewed master@289b35f -> upgrade-api-37@372e8a6 only.

  • P2 The toolchain upgrade has no active CI check.

Checks

  • git diff --check - passed.
  • GitHub PR checks - none reported; Actions are disabled and no workflows exist.
  • Gradle build - not run: this host has no Java or Android SDK, and the repository has no active CI.

Comment thread .circleci/config.yml Outdated
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_ACCESS_TOKEN
image: cimg/android:2024.01.1
image: cimg/android:2026.07.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Run the upgrade in the active CI

This edit only updates retired CircleCI configuration. GitHub reports no checks for this head. This repository has no workflows, and Actions are disabled. The AGP 9.3 and Gradle 9.5 migration can merge without :sdk:test or a demo build running.

Reproduce

  1. Push this branch.
  2. Open the PR checks.
  3. No build or test check appears.

Fix

Move the JDK 17+, API 37, and Gradle task changes into the current GitHub Actions pipeline. Make that pipeline report a required PR check. Run :sdk:test and a demo build there. Remove this dead CircleCI edit.

@zhuravel zhuravel self-assigned this Aug 12, 2026
@zhuravel zhuravel added the LG Looks good label Aug 12, 2026
@dgtv
dgtv merged commit 109f000 into master Aug 12, 2026
1 check passed
@dgtv
dgtv deleted the upgrade-api-37 branch August 12, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LG Looks good

Development

Successfully merging this pull request may close these issues.

2 participants