-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Updated gradle configuration for gradle 3.0.0+ #2096
Conversation
LGTM @alvelig 🐽 |
@rborn will this be updated in the next React Native Maps update? 0.20.2? How can I tell when it's included in a release version? |
@MarkOSullivan94 usually @christopherdro includes a change log when he does a release. |
@rborn can this PR be merged in? |
@christocracy how does this influences/compares with your PR #2047 |
As long as it uses the new |
LGTM |
@christocracy looks like it does, thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this PR has broken building react-native-maps master branch on Android...
@todorone how? what's wrong, error logs? |
@rborn It can be simply reproduced:
The solution was to reverse this commit and install according to old instructions. Seems that PS: Sorry for the message here rather than in issues. |
@todorone post your |
@christocracy It's default
|
gradle buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.1'
}
}
``` @ |
@christocracy maybe we should add a note in the docs (if it's not there already) about using gradle 3? |
@christocracy Thanks for the hint, but it definitely needs to be added to installation instructions... |
@todorone that would be a good PR 🤪 |
@rborn I've tried to use latest |
react-native-vector-icons has an unusual |
@todorone, If you have your project open in Android Studio, edit |
@christocracy So the latest news. Everything started to work, even while not touching That's the section of build.gradle:
And also adjusted in |
This PR was completely unnecessary and it goes against default react-native template which is still using gradle 2. As result it makes this project incompatible with some rn plugins which use gradle 2. If you need one - mauron85/react-native-background-geolocation#176. Also PR is incomplete without updating installation instructions how to update your project to gradle 3. Something like - https://medium.com/bam-tech/boost-compilation-time-of-your-react-native-or-android-app-with-the-latest-build-tools-a3d5d398ed33 I have also created new issue with more details #2180 Please revert this PR. |
No it was completely necessary for anyone wanting to use RN-Maps and is using Android Studio 3.x (the stable version is 3.1.1) otherwise they'll be unable to build the project successfully. Perhaps more instructions will be required, I just changed what I changed within my project to get RN Maps to work on Gradle 3.x and updated the docs with the steps I had to do. |
@MarkOSullivan94 I open all my RN gradle2 projects in Android Studio 3.1. Not sure what are you talking about. |
Got the following build error after changing build.gradle. I've upgraded Android Studio to 3.1.1 and the Gradle plugin. A problem occurred configuring root project 'xxxxxxx'.
|
Post your |
|
To your |
@christocracy
|
Replace it with:
|
Got me further. Now getting...
|
Now you circle back and verify your setup steps. |
@christocracy
But I did that. |
what version do you have installed? Does this path exist on your app?
|
@christocracy |
No idea. Load your app in Android Studio and look errors / warnings. |
…maps#2096)" This reverts commit 8cb158e.
- Cập nhật react 0.44.0-rc-4 - Cần cập nhật Gradle 3 (react-native-maps/react-native-maps#2096 (comment))
Just had a look over the React Native PRs, it looks like the RN project will be updated to Gradle 3.x soon: facebook/react-native#17747 |
Hi @MarkOSullivan94, could you please add documentation for this change? |
@lachenmayer are you having issues with getting it working? I'd look over your project setup and see if I can spot anything |
Thanks a lot Mark, I have created a repro project here: https://github.com/lachenmayer/react-native-maps-gradle-repro The reproThe repro contains detailed instructions for how to reproduce every step, and you can just click on every line item to verify the file changes. Note that I have left out all of the steps that I believe are irrelevant to this discussion, eg. setting up Google Maps API keys etc. I did use You should hopefully be able to see that when the changes from this PR are removed, the project builds as expected. The problem/goal
The goal I would like us to strive towards is that the library can be installed just using a simple This change has added significant complexity to the installation procedures when starting from Now, I am aware of the discussion in #2180. I understand your frustration that you are not able to use Gradle 3 by default - it is clearly superior, and I agree that React Native should be using it by default. However, at this point in time Gradle 3 is clearly a "power-user" feature which is mainly used by teams/individuals who are more likely to understand the intricacies of Android dependency management. I believe that the library should work out of the box for "everyone else" by default. In particular, we should not force people to have to upgrade the underlying tooling of their project just to get this particular dependency to build. Since Most importantly... The original bug report you submitted #2095 - which this PR does fix, in a sense - is not a bug. In your screenshot, you show the deprecation warnings that get triggered when you have Gradle >3 installed. These are just warnings, the project will still compile just fine, even with these warnings. If you are not convinced of this, I can update the repro project above to use Gradle >3. Possible solutions
Option 1 is obviously the least effort, but if you have the time to look into option 2 that would definitely be appreciated. It would be great if some of the maintainers could chime in here, so that we can get the project building out of the box again. Thanks folks! |
@lachenmayer absolutely fantastic work with that repo, so easy and clear to follow. I've forked your repo and made the necessary changes to get a successful build. The files changed are a bit misleading as the majority of the changes are done automatically within Android Studio whenever you update the Android projects gradle files. This is were you specify that wish to use gradle 3.0.1 for the project. This will result on a knock on affect within Android Studio recommending you to upgrade other dependencies which are old and outdated in React Native projects. Everything is suggested in the errors / warning messages. For example
This error message would indicate that your Android project doesn't have Gradle 3.0. If you would like to try and upgrade it yourself, focus on the build.gradle files: https://github.com/MarkOSullivan94/react-native-maps-gradle-repro/blob/master/android/build.gradle This is where you'll update dependencies until it will work with Gradle 3.0. Like I've said previously, Android Studio helps with recommendations on what to use, so I would recommend using it.
Perhaps I didn't include it in the original issue report but I would try and build our project using Android Studio it would not build because our existing Android project was already using Gradle 3.0+. It will produce a warning about the compile and provided keywords as shown by my screenshot in #2095 and unlike most other warnings in Android Studio, this one will cause it not to successfully build which is a big problem for anyone having similar issues. I know some might suggest not to use Android Studio however that is impossible whenever you consider Android applications which have React Native components within them (which is what we do). |
…maps#2096)" This reverts commit 8cb158e.
…maps#2096)" This reverts commit 8cb158e.
@todorone, Thanks man, it really works.
|
Further details on Gradle 3.0.0+ https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations
Is there any other PR opened that does the same ?
No.
What issue is this PR fixing
#2095
Also fixing installation.md which had the old gradle configuration and not the new one.