-
Notifications
You must be signed in to change notification settings - Fork 902
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
Fix duplicate Android packages being linked #43
Comments
Also - question - is the Gradle plugin version enforced by React Native? I am not really familiar, need to check, but... is the newer plugin version required, otherwise project will not build? If not, I can see scenarios when |
IIRC, we landed Android Gralde Plugin 3.x in RN 0.56 and we must be using implementation because Gradle will show deprecation warning if you use compile or compileOnly. So we should've fixed linking a long before. Usually, Android Gradle Plugin is versioned as same as Android Studio and used in it. And Google adds features, enhancements in it, so it's best to use latest version. Also Gradle version upgrades are mostly non-breaking, except 2.x to 3.x which require some manual work. FINAL: Use Gradle 3.x |
I'd like to add one more case where new CLI reports a duplicate: implementation (project(':react-native-device-info')) {
exclude group: 'com.google.android.gms'
} Seems like the extra paren(s) before |
There will be also an issue if you use:
|
Recent commit updated Android part of the link mechanism to use "implementation" instead of "compile" to align with what Gradle recommends: c6c34a2
Unfortunately, it breaks the detection of an already installed packages.
The way "link" detects an installed package on Android is by looking for "compile(XXX)" inside
build.gradle
. We don't have a sophisticated tool for parsing and reading Gradle files, hence we use a really simple RegExp to look for informations that we want. It was always meant to be a temporary solution, so we are going to work on resolving that in the nearest future.Meanwhile, what happens is that now, after the update, "link" will look for "implementation(XXX)" string instead to indicate that the given package is already linked.
This means that when "link" command is run on an existing codebase that still uses "compile" (e.g. just updated to a new project), it will not treat such project as installed and will add it once again, this time using
implementation(XXX)
. This results with duplicate packages.We should teach
link/android/isInstalled.js
to return "true" in both scenarios when "compile" and "implementation" are present. Both are valid right now in Gradle v3 (with "compile" being obsolete).We should also make sure that "unlink" can handle both cases.
CC: @thymikee @dulmandakh (original reviewer of the PR)
The text was updated successfully, but these errors were encountered: