question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android build errors with 0.22.1 around getLocales()

See original GitHub issue

Summary

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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:23 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ghsdh3409commented, Jul 28, 2018

@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

"react-native-device-info": "git+https://github.com/hayanmind/react-native-device-info.git#e1899138b95bc8f71aab1877c2c2627ecab5e1c4"
0reactions
mikehardycommented, Jun 12, 2019

Do what the example in this repo does, and it works - it’s why we have the example, to demonstrate + prove it works

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found