Skip to content

Commit d8f90bf

Browse files
committed
android build: Update Gradle to 6.0.1.
Part of the RN v0.61 -> v0.62 changes to the template app [1], corresponding to several commits, listed below. Probably best to do this before the main upgrade commit. The "Fixed issues" and the "Known issues" sections of the release notes (linked for each upgrade below) are particularly informative for the patch-version upgrades, where, otherwise, the release notes seem identical to those of the corresponding minor version. ----- v5.6 (facebook/react-native@be2a2529a) ----- Release notes from Gradle upstream: https://docs.gradle.org/5.6/release-notes.html Upgrade guide: https://docs.gradle.org/5.6/userguide/upgrading_version_5.html#changes_5.6 Before doing this upgrade, I ran `gradle help --scan` (actually, `./gradlew help --scan`) to check for deprecations that might turn into failures after the upgrade, as recommended by the upgrade guide. The report (https://scans.gradle.com/s/2pgdvrpgnpyms [2]) didn't have a "Deprecations" item in the left nav, as shown in the guide's screenshot, but it did show some deprecation warnings in the console. (A similar output was seen from the alternative command they suggest, `gradle help --warning-mode all`; I ran it with `./gradlew`.) We see this in the console for three of our dependencies: ``` WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html ``` The three dependencies are (with our issues to upgrade/replace, two of them filed just now): - `react-native-photo-view` zulip#4217 - `react-native-text-input-reset` zulip#4239 - `react-native-device-info` zulip#4240 The upgrade guide lists a few new deprecations; we may get warnings after the upgrade if they apply to us, but I suspect they may be given in the "Deprecations" section mentioned above, which we don't have, for whatever reason. It also lists several potential breaking changes, and I haven't understood them well enough to find if they apply to us. We hope to catch any that do in `tools/test android --full`. Unfortunately, we did run into a known issue with 5.6 (gradle/gradle#10347) that halted progress verifying the upgrade. React Native saw it too; facebook/react-native#26227 was filed to upgrade to 5.6.1 in response. That was closed and superseded by facebook/react-native#26349 (landed in facebook/react-native@b1c954b1f), done here and discussed below. ----- v5.6.2 (facebook/react-native@b1c954b1f) ----- Release notes from Gradle upstream: https://docs.gradle.org/5.6.1/release-notes.html https://docs.gradle.org/5.6.2/release-notes.html Upgrade guides: https://docs.gradle.org/5.6.1/userguide/upgrading_version_5.html#changes_5.6.1 https://docs.gradle.org/5.6.2/userguide/upgrading_version_5.html#changes_5.6.2 The release notes and upgrade guides appear close to identical to those for v5.6. One thing we could and did do here, with gradle/gradle#10347 fixed, is proceed with verifying the v5.6 upgrade, together with the changes from v5.6 to v5.6.2. The build scan report at v5.6.2 (https://scans.gradle.com/s/peks3ratsf7ee) was very similar to the one we ran before the v5.6 upgrade; those three deprecation warnings didn't turn into errors. `tools/test --full android` succeeded right away. ----- v5.6.3 (facebook/react-native@ff6b2ff32) ----- Release notes from Gradle upstream: https://docs.gradle.org/5.6.3/release-notes.html Upgrade guides: https://docs.gradle.org/5.6.3/userguide/upgrading_version_5.html#changes_5.6.3 All near-identical to the previous docs. The build scan report at v5.6.3 (https://gradle.com/s/3holiaylf6jku) also looks very similar to those at past versions. At first, I got a build failure that I didn't get with the previous upgrades: ``` java.nio.file.NoSuchFileException: /Users/chrisbobbe/dev/zulip-mobile/android/app/build/intermediates/external_file_lib_dex_archives/debug/out at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) [...] ``` It went away after deleting `android/.gradle` and running `./gradlew clean` (from SO: https://stackoverflow.com/a/62025502). ----- v5.6.4 (facebook/react-native@928f4434b) ----- Release notes from Gradle upstream: https://docs.gradle.org/5.6.4/release-notes.html Upgrade guides: https://docs.gradle.org/5.6.4/userguide/upgrading_version_5.html#changes_5.6.4 The build scan report at v5.6.4 (https://gradle.com/s/2szkm2hvdrejy) also looks very similar to those at past versions. ----- v6.0.1 (facebook/react-native@701e66bde) ----- Release notes from Gradle upstream: https://docs.gradle.org/6.0.1/release-notes.html Upgrade guides: https://docs.gradle.org/6.0.1/userguide/upgrading_version_5.html#changes_6.0.1 The upgrade guide lists many new deprecations, and we are newly seeing some deprecation warnings in the build scan (see below). It also lists several potential breaking changes, and I haven't understood them well enough to find if they apply to us. We hope to catch any that do in `tools/test android --full`. This time, the build scan report for v6.0.1 (https://scans.gradle.com/s/l7q26kntclub6) does have a "Deprecations" section. Its contents: """ BuildListener#buildStarted(Gradle) has been deprecated. This is scheduled to be removed in Gradle 7.0. 32 usages The maven plugin has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the maven-publish plugin instead. 19 usages """ Expanding the 32 usages in the first of these, all but one are in the `com.android.library` plugin; one is in the `android` plugin. Expanding the 19 usages in the second of these, they're all in the `org.gradle.maven` plugin. I encountered a build failure ("No file known for: classes.dex") but was able to fix it by clearing `android.gradle` and running `./gradlew clean`. [1] https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.2 [2] The build scan at this link will be "available indefinitely", according to https://scans.gradle.com/.
1 parent 80acbe9 commit d8f90bf

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

android/gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919

20-
android.enableJetifier=true
20+
# AndroidX package structure to make it clearer which packages are bundled with the
21+
# Android operating system, and which are packaged with your app's APK
22+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2123
android.useAndroidX=true
24+
# Automatically convert third-party libraries to use AndroidX
25+
android.enableJetifier=true

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# $ ./gradlew wrapper --distribution-type=all --gradle-version=NEW_VERSION
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
66
zipStoreBase=GRADLE_USER_HOME
77
zipStorePath=wrapper/dists

android/gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
99
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
10+
# https://www.apache.org/licenses/LICENSE-2.0
1111
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -125,8 +125,8 @@ if $darwin; then
125125
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126126
fi
127127

128-
# For Cygwin, switch paths to Windows format before running java
129-
if $cygwin ; then
128+
# For Cygwin or MSYS, switch paths to Windows format before running java
129+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130130
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131131
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132132
JAVACMD=`cygpath --unix "$JAVACMD"`

android/gradlew.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@rem you may not use this file except in compliance with the License.
66
@rem You may obtain a copy of the License at
77
@rem
8-
@rem http://www.apache.org/licenses/LICENSE-2.0
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
99
@rem
1010
@rem Unless required by applicable law or agreed to in writing, software
1111
@rem distributed under the License is distributed on an "AS IS" BASIS,

docs/howto/build-run.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,33 @@ To fix the problem, run `yarn`, which will update your installed
211211
packages in `node_modules/` to match the current `package.json`. You
212212
might need to restart Metro / `react-native start` after doing so.
213213

214+
### Build failure: java.nio.file.NoSuchFileException: /Users/chrisbobbe/dev/zulip-mobile/android/app/build/intermediates/
215+
216+
When trying to build the Android app, you may see this error:
217+
218+
```
219+
java.nio.file.NoSuchFileException: /Users/chrisbobbe/dev/zulip-mobile/android/app/build/intermediates/external_file_lib_dex_archives/debug/out
220+
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
221+
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
222+
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
223+
at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:407)
224+
```
225+
226+
Try removing `android/.gradle`, running `./gradlew clean` from
227+
`android/`, and building again.
228+
229+
### Build failure: No file known for: classes.dex
230+
231+
When trying to build the Android app, you may see this error:
232+
233+
```
234+
Execution failed for task ':app:packageDebug'.
235+
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
236+
> No file known for: classes.dex
237+
```
238+
239+
Try removing `android/.gradle`, running `./gradlew clean` from
240+
`android/`, and building again.
214241

215242
### Build failure: java.lang.UnsupportedClassVersionError, "Unsupported major.minor version 52.0"
216243

0 commit comments

Comments
 (0)