Skip to content

[V3]It is recommended to migrate the dependency management of local_repo under the Android system into the project itself. #1280

@2Stephen

Description

@2Stephen

Proposal

Bug

error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'. 
> Could not find org.asyncstorage.shared_storage:storage-android:1.0.0. Required by: project ':app' 
> project :react-native-async-storage_async-storage * Try:

Resolve Detail

When I imported this dependency and tried to compile it into an Android app, the system threw the error "ould not find org.asyncstorage.shared_storage:storage-android:1.0.0". I tried many solutions, but none worked. I also couldn't find the dependency org.asyncstorage.shared_storage:storage-android:1.0.0 in official repositories such as Maven Central. Finally, I checked the official repository and found that the README states you need to declare the local_repo before building for Android so that this dependency can be resolved correctly.

Alternatives

To improve user experience, I tried modifying the build.gradle file located in the directory:
@react-native-async-storage/async-storage/android/src.
I found that simply adding this:

def storageRepo = "$projectDir/local_repo"

rootProject.allprojects {
    repositories {
        maven {
            url storageRepo
        }
    }
}

To avoid Groovy closure issues, we must define storageRepo outside the closure.

Implementation Details

It allows the project to compile successfully, without requiring users to manually configure the local_repo path.

Additional Context

PR: #1279

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv3Related to version 3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions