Android build errors with 0.22.1 around getLocales()
See original GitHub issueSummary
I recently just upped my version of this library to 0.22.1 from 0.21.5 and everything is working locally for me. But when I run my build in Travis CI the build is failing with these errors.
Travis CI Java: Switching to Oracle JDK8 (java-8-oracle), JAVA_HOME will be set to /usr/lib/jvm/java-8-oracle
/home/travis/build/<user>/<appname>/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:71: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
^
symbol: variable N
location: class VERSION_CODES
/home/travis/build/<user>/<appname>/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:72: error: cannot find symbol
current = getReactApplicationContext().getResources().getConfiguration().getLocales().get(0);
^
symbol: method getLocales()
location: class Configuration
/home/travis/build/<user>/<appname>/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:92: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
^
symbol: variable N
location: class VERSION_CODES
/home/travis/build/<user>/<appname>/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:93: error: cannot find symbol
current = getReactApplicationContext().getResources().getConfiguration().getLocales().get(0);
^
symbol: method getLocales()
location: class Configuration
Note: /home/travis/build/<user>/<appname>/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
:react-native-device-info:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Version | 0.22.1 |
Affected OS | Android |
OS Version | SDK 26 |
Current behavior
Builds fails on gradle command
/home/travis/build/<user>/<appname>/android/gradlew assembledevRelease -p ./android -DENVFILE=.env --no-daemon --max-workers 2
Expected behavior
Expecting the build to be successful.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:23 (3 by maintainers)
Top Results From Across the Web
[FIXED] Android build failures `No matching variant of ... - GitHub
Description Hey all, I'd like to share an update on a series of build failures React Native & Expo users have been experiencing...
Read more >React Native Android build failure with different errors without ...
The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 . Note: Error may be different but...
Read more >Android Studio 2022.1.1 Closed Issues
If the namespace is moved to build.gradle, the build fails with an unreferenceable R declaration. New Code/Templates. Issue #178508739.
Read more >Known issues with Android Studio and Android Gradle Plugin
This update causes an underlying behavior change related to signing keys. When you navigate to Build > Generate Signed Bundle / APK and...
Read more >Android Studio 2021.1.1 Closed Issues
Can't build after updating to AGP 7.2.0-alpha04. Issue #201263841. Play Asset Delivery: bundle does not include all asset packs.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@reedyrm @maksim-harakhovich-itechart @kingmatusevich @tbenr @cusspvz
I made a pull request. https://github.com/rebeccahughes/react-native-device-info/pull/460 Could you check that this change resolves this issue?
You can install this by following in
package.json
Do what the example in this repo does, and it works - it’s why we have the example, to demonstrate + prove it works