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.

RN 0.61 Android build fails

See original GitHub issue

This likely has to do with AndroidX or other things of which I am somewhat ignorant, but here’s what I can share:

I had react-native-reanimated working fine in my RN 0.60.5 app. Today I tried to upgrade to RN 0.61, and the Android build (via react-native run-android) stopped working. It gave an error message like this:

/.../android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:37: error: package com.swmansion.reanimated does not exist
import com.swmansion.reanimated.ReanimatedPackage;
                               ^
/.../android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:89: error: cannot find symbol
      new ReanimatedPackage(),
          ^
  symbol:   class ReanimatedPackage
  location: class PackageList
2 errors

FAILURE: Build failed with an exception.

I examined the changes to the android directory of the RN template that occurred between 0.60.5 and 0.61, and this one looks relevant: https://github.com/facebook/react-native/pull/25810

When I re-add the supportLibVersion line to my android/build.gradle, the build seems to work again. I’m not sure if this is proper or if it implies something is going wrong with the jetify process for this library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

55reactions
lbornov2commented, Dec 12, 2019

I am still facing this.

My package.json:

{
  "name": "MyApp",
  "version": "4.2.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "postversion": "react-native-version",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "axios": "^0.19.0",
    "i18n-js": "^3.5.0",
    "js-sha256": "^0.9.0",
    "lodash": "^4.17.15",
    "lodash.memoize": "^4.1.2",
    "moment": "^2.24.0",
    "otplib": "^11.0.1",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-app-link": "^1.0.0",
    "react-native-blink-view": "^0.0.6",
    "react-native-camera": "^3.9.0",
    "react-native-crypto": "^2.2.0",
    "react-native-device-info": "^4.0.1",
    "react-native-elements": "^1.2.6",
    "react-native-firebase": "^5.5.6",
    "react-native-flash-message": "^0.1.15",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^1.3.1",
    "react-native-app-commons": "https://bitbucket.org/app/react-native-app-commons#RELEASE-4.2.0",
    "react-native-progress": "^4.0.1",
    "react-native-progress-circle": "^2.1.0",
    "react-native-qrcode-scanner": "^1.2.3",
    "react-native-randombytes": "^3.5.3",
    "react-native-rate": "^1.1.10",
    "react-native-reanimated": "^1.3.0",
    "react-native-screens": "^1.0.0-alpha.23",
    "react-native-share": "^2.0.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^9.12.0",
    "react-native-svg-transformer": "^0.13.0",
    "react-native-swipeout": "^2.3.6",
    "react-native-touch-id": "^4.4.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^7.4.2",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.3.1",
    "react-navigation-hooks": "^1.1.0",
    "react-navigation-stack": "^1.10.2",
    "react-navigation-tabs": "^2.5.6",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "url-parse": "^1.4.7"
  },
  "devDependencies": {
    "@babel/core": "^7.6.4",
    "@babel/runtime": "^7.6.3",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-native-version": "^3.2.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "react-native": {
    "crypto": "react-native-crypto"
  },
  "browser": {
    "crypto": "react-native-crypto"
  }
}

Command used to run:

rm -rf node_modules && yarn && rm -rf ~/.gradle/caches/* && ./scripts/buildAndroidRelease.sh

I also get the same issue when updating react-native-reanimated to 1.4.0

I managed to fix this by adding this into my build.gradle

allprojects {
  tasks.withType(Javadoc).all { enabled = false }
8reactions
pandevimcommented, Jan 28, 2021
Package Version
react 16.13.1
react-native 0.63.4
react-native-reanimated 1.13.2

I removed the following lines from MainApplication.java and it worked for me!

import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;

@Override
protected JSIModulePackage getJSIModulePackage() {
  return new ReanimatedJSIModulePackage();
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[FIXED] Android build failures `No matching variant of ... - GitHub
This event resulted in build failures for Android on several users as they ended up downloading the wrong React Native version ( 0.71.0-rc0 ......
Read more >
A failure occurred while executing com.android.build.gradle ...
The answer lies here depending on the version of your react native. Patches are available for RN version 0.63 and up.
Read more >
npx react-native run-android build failed - You.com
* What went wrong: Task 'installDebug' ; * Try: Run gradlew tasks to get a list of available tasks. Run with --stacktrace option...
Read more >
React Native Upgrade Helper
React Native 0.62 includes built-in integration with Flipper. ... 22, # https://developer.android.com/topic/libraries/support-library/androidx-rn.
Read more >
Building React Native app for multiple environments (updated ...
Here is where iOS Build Configurations and Android Build Variants comes ... This reason for this error is because the dependency libraries ...
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