Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new repositories by maven in android buid.gradle, not work when build project #39114

Closed
Andersonfrfilho opened this issue Aug 22, 2023 · 8 comments
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library

Comments

@Andersonfrfilho
Copy link

Description

When I add a new external repository with

android/build.gradle

  repositories {
    google()
    mavenCentral()
    maven { url "https://zendesk.jfrog.io/zendesk/repo/" }
  }

when building the project with:
npm run android, it doesn't search the referenced repositories.
I'm try change order the called but not work:

  repositories {
    google()
    maven { url "https://zendesk.jfrog.io/zendesk/repo/" }
    mavenCentral()
  }

when removed maveCentral() - is called but the main ones are not

React Native Version

0.72.4

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: Linux 5.14 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 6.82 GB / 15.40 GB
Shell:
version: 5.8.1
path: /usr/bin/zsh
Binaries:
Node:
version: 16.14.2
path: ~/.nvm/versions/node/v16.14.2/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v16.14.2/bin/yarn
npm:
version: 8.5.0
path: ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "29"
- "30"
- "31"
- "32"
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.2
- 30.0.3
- 34.0.0
System Images:
- android-UpsideDownCakePrivacySandbox | Google Play Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: AI-213.7172.25.2113.9123335
Languages:
Java:
version: 11.0.20
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

Snack, screenshot, or link to a repository

git clone - https://github.com/Andersonfrfilho/sunshine-module-react-native

@cortinico
Copy link
Contributor

Hey @Andersonfrfilho
I advice you to do the following:

  1. I see you're specifying the repository in two places:
buildscript {
  repositories {
    google()
    mavenCentral()
    maven { url "https://zendesk.jfrog.io/zendesk/repo/" }
  }
}

...

repositories {
  mavenCentral()
  google()
  maven { url "https://zendesk.jfrog.io/zendesk/repo/" }
}

you practically need only this:

repositories {
  maven { url "https://zendesk.jfrog.io/zendesk/repo/" }
}

as mavenCentral() and google() are already included for you if you're in React Native 0.72

  1. I'll be closing this issue as the problem you're having is with the library template, so you will have to open another issue here https://github.com/callstack/react-native-builder-bob/issues and ask for further support

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library and removed Needs: Triage 🔍 labels Aug 23, 2023
@Andersonfrfilho
Copy link
Author

@cortinico, I believe you did not understand the problem, we were developing a test of a new native module for react-native, the example project requires that the repository be added to the folders:
https://github.com/Andersonfrfilho/sunshine-module-react-native/blob/main/example/android/build.gradle, but when adding it there it has no effect except when we remove mavenCentral()
The problem is not in the library but in the react-native android build

@eduardoborges
Copy link

Hey @Andersonfrfilho you have some progress in this issue?
I had the same problem with Maven URL repos.

@Andersonfrfilho
Copy link
Author

@eduardoborges, I had to download and import the module manually using Android Studio in the react-native project

@eduardoborges
Copy link

@Andersonfrfilho in the library on directly on your rn app? Can you give me more details?

@ayoubechc
Copy link

Any update plz

@GeraldoLimaGlance
Copy link

I'm facing the same problem too

@wirrareka
Copy link

wirrareka commented Sep 23, 2024

stumbled upon this one too, wrapping the repositories inside allprojects solved it for me

allprojects {
    repositories {
        maven { url "https://maven.yolo.com/android-releases/" }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer Resolution: Issue in another tool or repo An issue that was opened against React Native but in reality is affecting another tool or library
Projects
None yet
Development

No branches or pull requests

6 participants