fix(android-player): remove unused codegen block causing Android build failure#223
fix(android-player): remove unused codegen block causing Android build failure#223kherembourg wants to merge 6 commits intomainfrom
Conversation
The `react { jsRootDir = file("../src/") }` block in build.gradle
triggered React Native codegen to look for a `src/` directory that
is not included in the published npm package, causing Android builds
to fail with ENOENT on `generateCodegenSchemaFromJavaScript`.
Since android-player has no Turbo Module specs (it uses NativeModules,
the old architecture bridge), the codegen block was both unnecessary
and broken. Removing it and the related `isNewArchitectureEnabled()`
helper fixes the build for all consumers without any loss of
functionality.
Fixes: #213 (comment)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical Android build failure experienced by users of the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request resolves an Android build failure by removing unused code related to React Native's new architecture from the android-player's build.gradle file. The changes correctly remove the isNewArchitectureEnabled checks and the associated react block that was causing the build to fail by referencing a non-existent src/ directory. The fix is well-contained and directly addresses the root cause described in the pull request.
…e turbo env gradle.properties used PurchaselyGoogle_ prefix while build.gradle reads PurchaselyAndroidPlayer_ — causing NPE on standalone builds. turbo.json declared ORG_GRADLE_PROJECT_newArchEnabled (removed with the codegen block) and a build:ios task irrelevant for this Android-only package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
For all four satellite packages (android-player, google, amazon, huawei):
- AGP: 7.3.1 → 8.7.3 (aligns with main purchasely package)
- Java/Kotlin: VERSION_1_8 → VERSION_11, add kotlinOptions jvmTarget=11
- Add namespace declaration to android{} block (required by AGP 8+)
- Replace dead 64-line RN source-lookup block with google()/mavenCentral()
The lookup was superseded by RNGP in RN 0.71; confirmed present in
example/android/settings.gradle
- Remove jcenter() (shut down Feb 2022)
- Keep mavenLocal() in buildscript repos for local library development
- Preserve Huawei-specific Maven repo and agcp classpath in huawei package
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- source field: ./src/index.tsx → ./src/index.ts (file has no JSX) - repository.url: packages/google → packages/android-player (copy-paste leftover) - homepage: same correction Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Script API All four satellite packages (android-player, google, amazon, huawei) exported a multiply(a, b) function that was leftover from the React Native library template. These packages function as native dependency carriers — they bring in store-specific Gradle dependencies. No JavaScript API is needed. Also fixes huawei/src/index.ts which incorrectly referenced PurchaselyGoogle instead of PurchaselyHuawei. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…et mismatch With AGP 8 and JDK 17 in CI, javac targets 17 while kotlinOptions jvmTarget=11 caused: "Inconsistent JVM-target compatibility (17 vs 11)". Remove explicit jvmTarget — AGP automatically aligns Kotlin to match the Java compileOptions target, consistent with the main purchasely package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem
Users building Android apps with
@purchasely/react-native-purchasely-android-playerget a build failure:The
build.gradlecontained areact { jsRootDir = file("../src/") }block that instructs React Native codegen to scan thesrc/directory during Android builds. However, thesrc/folder is not included in the published npm package (it's absent from thefilesfield inpackage.json), so the directory doesn't exist innode_modules— causing an immediate crash.Root cause
The codegen block was vestigial. The package uses
NativeModules(old architecture bridge) with no Turbo Module specs — codegen has nothing to generate fromsrc/anyway. The block was never needed and actively broke builds.Fix
Remove the dead code entirely:
def isNewArchitectureEnabled()helper functionif (isNewArchitectureEnabled()) { apply plugin: 'com.facebook.react' }if (isNewArchitectureEnabled()) { react { jsRootDir = ... } }blockIS_NEW_ARCHITECTURE_ENABLEDbuild config field (unused in source code)No functional change — the package never used codegen.
Affected versions
All published versions (confirmed on 5.2.0 and 5.7.0).
Related
Reported by @nicost71 in #213.
Test plan
src/directory workaround🤖 Generated with Claude Code