10

I already upgraded react-native from version 0.64.1 to 0.65.0-rc.3 because targetSdk=30 is required to publish a bundle to Google Play from 1st august 21. I was upgrading letter to letter using upgrade helper Now I am getting ./gradlew bundleRelease error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseAssets'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Failed to transform react-native-reanimated-65-jsc.aar (project :react-native-reanimated) to match attributes {artifactType=android-assets}.
      > Execution failed for JetifyTransform: MyApp/node_modules/react-native-reanimated/android/react-native-reanimated-65-jsc.aar.
         > Transform's input file does not exist: MyApp/node_modules/react-native-reanimated/android/react-native-reanimated-65-jsc.aar. (See https://issuetracker.google.com/issues/158753935)

Already tried:

  • removing node_modules, reinstalling again
  • cleaning gradle, project, yarn cache, etc...
  • tried to jetify explicitly
  • upgrade android studio
  • upgrade react-native-reanimated to the newest version

Spent hours in frustration that there is no stable release of react-native to proceed through Google requirements. Any ideas to make it work?

----- EDIT ----

As a temporary workaround it's enough to change just versions in the project level gradle file:

ext {
  buildToolsVersion = "30.0.2"
  minSdkVersion = 21
  compileSdkVersion = 30
  targetSdkVersion = 30
  ndkVersion = "20.1.5948944"
}
matusalem
  • 2,461
  • 2
  • 26
  • 35

6 Answers6

4

I have just upgraded to RN 0.65 stable and have the same error on Android. I think it is because it is a little early to upgrade if you want to use react-native-reanimated package v2.0. They probably haven't not upgraded Android to RN 0.65 yet. See similar issue that happened for early upgraders to RN 0.64-rc.1 who used RN Reanimated v. 2.0: https://github.com/software-mansion/react-native-reanimated/issues/1486. We need to wait for RN Reanimated to upgrade their library.

EDIT: Here's the link for RN Reanimated incompatibility with RN 0.65 issue on Github: https://github.com/software-mansion/react-native-reanimated/issues/2290.

EDIT 2: Can confirm that upgrading to RN Reanimated v.2.3.0-alpha.2 solves this problem and Android builds succeed with RN 0.65.

  • 2
    thanks for the github issue link, after updating reanimated to 2.3.0-alpha.2 my android build is successful now while using react-native 0.65.0 – Nald Dev Aug 18 '21 at 20:06
  • Please share your podfile. I can't build iOS – Ian Aug 19 '21 at 05:49
  • iOS builds right off the bat for me with RN 0.65. I'm using standard RN template Podfile: https://github.com/facebook/react-native/blob/main/template/ios/Podfile. – PunainenAurinko Aug 19 '21 at 15:07
2

Please make sure that you have these modules exactly how they're written in your package.json, else it will fail. I saw a lot of native emitter errors on the react-native-reanimated.

"react": "17.0.2",
"react-native": "0.65",
"react-native-reanimated": "^2.3.0-alpha.2",

Delete your old npm modules. Then run yarn install.

I have tried using the > yarn add react-native-reanimated@next but build failed. my latest build ran on that package.json. I am not too sure about IOS builds.

My build on android was successful as well with these dependencies. I ran problems with npm along the way so I switched to yarn.

I don't know specifically why a lot of people were having errors but mine worked even with the rc3 of react native.

"react-native": "0.65.0-rc.3",
"react-native-reanimated": "^2.3.0-alpha.2",

################################################################

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Redmi Note 8 Pro - 11' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 1m 40s
133 actionable tasks: 110 executed, 23 up-to-date
info Connecting to the development server...
info Starting the app...
Starting: Intent { cmp=com.myapp/.MainActivity }
Jericho
  • 161
  • 1
  • 9
  • You are using an alpha version of reanimated which happened to include the fix to the issue. It is an alpha release though so most people are not using it. They are most likely still using the latest stable (2.2 as of this moment). – Adonis K. Kakoulidis Aug 23 '21 at 11:12
  • well still the Native Emitter problem actually rexzists on alpha just recently as ive tried. I stopped RN for now and gone back to react until they release a stable one's; :) – Jericho Aug 23 '21 at 21:58
0

try this:

npm i react-native-reanimated@^1.13.2
Mohamad
  • 36
  • 4
0

Nothing worked for me so I reinstalled lower version of RN, previously I was working with RN 0.65.1=>

npm install react-native@0.64.2

0

The only version of reanimated which is compatible with react native v65 is v2.3.0-alpha3. Try This

Alireza Hadjar
  • 450
  • 4
  • 10
0

Go to android/app/build.gradle and add the following lines of codes:

dependencies {
  implementation 'com.android.support:multidex:2.0.1' //enter the latest multidex version
}
android {
    defaultConfig {
        multiDexEnabled true
    }
}
Khalil
  • 1
  • 1