fix: auto-configure local Maven repo for shared-storage dependency#1272
Open
roidayan1 wants to merge 1 commit intoreact-native-async-storage:mainfrom
Open
fix: auto-configure local Maven repo for shared-storage dependency#1272roidayan1 wants to merge 1 commit intoreact-native-async-storage:mainfrom
roidayan1 wants to merge 1 commit intoreact-native-async-storage:mainfrom
Conversation
The shared-storage artifact (org.asyncstorage.shared_storage:storage-android) is not published to Maven Central, so Android builds fail unless the consumer manually adds the local_repo Maven URL to their root build.gradle. Move this configuration into the library's own build.gradle so it works automatically. This removes the manual Android setup step from installation. - Add local_repo Maven URL to module repositories - Add rootProject.allprojects hook for transitive resolution - Remove manual Android setup instructions from README and migration guide - Remove manual repo config from example project
|
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.
Summary
shared-storagein the library's ownbuild.gradleProblem
The
org.asyncstorage.shared_storage:storage-android:1.0.0artifact is bundled inandroid/local_repo/but is not published to Maven Central or Google's Maven repository. This means every consumer must manually add the local Maven URL to their rootandroid/build.gradle:allprojects { repositories { maven { url = uri(project(":react-native-async-storage_async-storage").file("local_repo")) } } }This is easy to miss during installation and causes confusing Gradle build failures (
Could not find org.asyncstorage.shared_storage:storage-android:1.0.0).Fix
Add the local Maven repository configuration directly to the library's
packages/async-storage/android/build.gradle:maven { url("${project.projectDir}/local_repo") }— resolves the dependency for the module itselfmaven { url("${rootDir}/../node_modules/...") }— ensures transitive resolution across the entire Android buildThis makes it work out of the box — no manual setup required.
Changes
packages/async-storage/android/build.gradle— add local Maven repo configurationREADME.md— remove manual Android setup sectiondocs/migration-to-3.md— remove manual Android setup instructionsexamples/react-native/android/build.gradle— remove manual repo config (now inherited)Patch (for patch-package users)
Until this is released, you can use this patch with patch-package:
@react-native-async-storage+async-storage+3.0.1.patch