Skip to content

Conversation

@1mehdifaraji
Copy link
Contributor

This PR updates android/build.gradle to resolve common build issues in modern React Native versions (0.74+):

  • Removes the outdated buildscript block, which forces downloading AGP 7.2.1 (causing TLS handshake failures via proxies/VPNs). Now inherits the root project's modern AGP (8.x+).
  • Adds packaging options to fix resource merging errors in Gradle 8+ (e.g., duplicate META-INF files).

Tested on RN 0.75: Builds cleanly without patches.

Please consider publishing a new npm version after merge (last release was v3.2.4 in 2022—many users install from GitHub master due to outdated npm).

@safaiyeh
Copy link
Member

thank you @1mehdifaraji! added a revive tag, I will merge this in once I upgrade the repo's tooling

@safaiyeh
Copy link
Member

@greptile review

@greptile-apps
Copy link

greptile-apps bot commented Dec 27, 2025

Greptile Summary

This PR modernizes the Android build configuration for React Native 0.74+ by removing the outdated buildscript block that pinned AGP 7.2.1 and adding packaging resource excludes for Gradle 8+ compatibility.

Key Changes:

  • Removed hardcoded AGP 7.2.1 dependency that caused TLS handshake failures through proxies/VPNs
  • Library now inherits AGP version from root project (typically 8.x+ in modern RN)
  • Added packaging.resources.excludes block to prevent META-INF file conflicts during resource merging
  • Removed obsolete inline comments for cleaner code

Impact:

  • Resolves build failures on RN 0.74+ with modern Gradle 8.x
  • Maintains backwards compatibility (older RN versions will still work with their respective AGP versions)
  • Aligns with React Native library best practices by delegating AGP version management to the root project

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes follow Android/React Native library best practices by removing version pinning and adding standard packaging excludes. The removal of the buildscript block allows proper AGP inheritance from the root project, which is the recommended approach for React Native libraries. The packaging excludes are a standard solution for META-INF conflicts in Gradle 8+. No behavioral changes to the library itself, only build configuration improvements.
  • No files require special attention

Important Files Changed

Filename Overview
android/build.gradle Removed outdated buildscript block pinning AGP 7.2.1, added packaging excludes for Gradle 8+ compatibility

Sequence Diagram

sequenceDiagram
    participant RootProject as Root Project build.gradle
    participant LibModule as Library Module build.gradle
    participant AGP as Android Gradle Plugin
    participant Gradle as Gradle 8.x

    Note over RootProject,Gradle: Before: Hardcoded AGP 7.2.1
    RootProject->>LibModule: buildscript block executes
    LibModule->>AGP: Force download AGP 7.2.1
    AGP-->>LibModule: TLS handshake failures (via proxy/VPN)
    LibModule->>Gradle: Attempt build
    Gradle-->>LibModule: Resource merging errors (missing packaging config)

    Note over RootProject,Gradle: After: Inherit Modern AGP
    RootProject->>LibModule: Apply plugins (com.android.library, kotlin-android)
    LibModule->>AGP: Inherit AGP version from root (8.x+)
    AGP-->>LibModule: Modern AGP loaded successfully
    LibModule->>Gradle: Build with packaging excludes
    Note over LibModule,Gradle: packaging.resources.excludes handles META-INF conflicts
    Gradle-->>LibModule: Build succeeds cleanly
Loading

@greptile-apps
Copy link

greptile-apps bot commented Dec 27, 2025

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@safaiyeh safaiyeh self-requested a review December 27, 2025 21:20
@safaiyeh safaiyeh merged commit 13f6dce into react-native-voice:master Dec 27, 2025
4 checks passed
safaiyeh pushed a commit that referenced this pull request Dec 27, 2025
# [3.3.0](v3.2.4...v3.3.0) (2025-12-27)

### Bug Fixes

* **android:** update build.gradle for RN 0.74+ compatibility ([#577](#577)) ([13f6dce](13f6dce))
* **Expo:** Config plugin setup ([#543](#543)) ([c33c67d](c33c67d))
* fix illegal type in boxed expression ([#452](#452)) ([32aab8b](32aab8b))
* **ios:** correctly link frameworks required ([#535](#535)) ([2a7d27a](2a7d27a))

### Features

* **iOS:** Enable file transcriptions ([#409](#409)) ([03da891](03da891))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants