Fix #63: plugin nativephp/mobile-camera mins sdk#70
Closed
shanerbaner82 wants to merge 1 commit intomainfrom
Closed
Fix #63: plugin nativephp/mobile-camera mins sdk#70shanerbaner82 wants to merge 1 commit intomainfrom
shanerbaner82 wants to merge 1 commit intomainfrom
Conversation
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.
Closes #63
Summary
Now I have a complete picture. Here's the analysis:
Root Cause:
There are two separate but related problems:
The
mobile-cameraplugin'snativephp.jsonmanifest incorrectly declaresandroid.min_version: 33. The Kotlin code is fully guarded withBuild.VERSION.SDK_INTruntime checks — API 33 was never actually required. This is the primary bug (to be fixed in themobile-camerarepo via Lower Android min SDK requirement from 33 to 26 mobile-camera#5).A secondary inconsistency in
mobile-airitself: The config default formin_sdkinconfig/nativephp.php:172is 33, but the validation logic inRunsAndroid.php:75andPackageCommand.php:143reads from config with a fallback default of 26. This means when users setNATIVEPHP_ANDROID_MIN_SDK=33(as the reporter tried), it has no effect on bypassing the validation — the plugin's declaredmin_version: 33matches the SDK, so it shouldn't block. But the actual effective min SDK used during build (PreparesBuild.php:797) also defaults to 33, meaning the mismatch report the user saw came from their app's.envhavingNATIVEPHP_ANDROID_MIN_SDKunset while the config defaulted to 26 in the validation path but 33 in the build path.Files to Change:
nativephp/mobile-camera—nativephp.jsonmanifest: lowerandroid.min_versionfrom33to26(separate repo, tracked in Lower Android min SDK requirement from 33 to 26 mobile-camera#5)src/Traits/PreparesBuild.php:797— The fallback default formin_sdkis33; this should be26to match the NativePHP floor and be consistent withRunsAndroid.phpandPackageCommand.phpProposed Fix:
In
mobile-camera(Lower Android min SDK requirement from 33 to 26 mobile-camera#5): Changeandroid.min_versionin the plugin manifest from33→26, since the Kotlin code already usesBuild.VERSION.SDK_INTguards for all API-level-specific calls.In
mobile-air(PreparesBuild.php:797): Change the fallback default from33to26:This makes the build-time default consistent with the validation defaults in
RunsAndroid.phpandPackageCommand.php, which both use26.Risks:
PreparesBuild.phpdefault change only affects users who have not setNATIVEPHP_ANDROID_MIN_SDKin their.envand have not setmin_sdkinconfig/nativephp.php. These users would get a lower effective min SDK in their built APK (26 instead of 33). This is generally safe since NativePHP's floor is 26 and the validation already enforces it. Theconfig/nativephp.phpfile itself still defaults to 33 (env('NATIVEPHP_ANDROID_MIN_SDK', 33)) so any user reading the config will get 33 — thePreparesBuild.phpfallback of 26 is only a safety net if config resolution fails, making this change very low risk in practice.mobile-cameraplugin manifest. ThePreparesBuild.phpinconsistency is a separate latent bug worth fixing to prevent future confusion.