Skip to content

Conversation

jkasten2
Copy link
Member

@jkasten2 jkasten2 commented Jun 27, 2025

Description

One Line Summary

Fixes startup crashes with Android 7, on getParameterCount(), when the app is built with AGP 7 or older.

Details

This method isn't compatible with Android 7 and older devices and causes a crash.
AGP 8 (Android Gradle Plugin) added compatibility for this, however its not uncommon for app developers to still be on 7.

The getParameterCount() was added to be cautious, however there isn't a known case where this is needed so we removed it in this PR. While it's possible to have getPropertyX and getPropertyX(param1) this isn't something that should be in our code based as this is against our coding conventions

Motivation

We want to still support Android 5-7 versions and Gradle 7.

Scope

Effects deserialization of JSON into model objects.

Related

This fixes #2323

Testing

Unit testing

No unit test changes were needed.

Manual testing

Tested on an Android 5 emulator.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

This method isn't compatible with Android 7 and older devices and
causes a crash.
AGP 8 (Android Gradle Plugin) added compatibility for this, however
its not uncommon for app developers to still be on 7
@jkasten2 jkasten2 merged commit 7bf5f49 into main Jun 27, 2025
2 checks passed
@jkasten2 jkasten2 deleted the fix/gradle7-with-android7-and-lower-crash branch June 27, 2025 20:23
@jkasten2 jkasten2 mentioned this pull request Jun 30, 2025
nan-li pushed a commit that referenced this pull request Jul 8, 2025
…-lower-crash

[Fix] Android 7 and lower crashes with getParameterCount calls, when the app is built with AGP 7 or older
@nan-li nan-li mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Crash on Android 6-7 when using SDK version 5.1.34 with a Gradle 7 project
2 participants