facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.72k stars 24.16k forks source link

Only release build of Android crash with React Native version mismatch error #32765

Closed DIGITALSQUAD closed 1 year ago

DIGITALSQUAD commented 2 years ago

New Version

0.63.3

Old Version

0.59.9

Build Target(s)

Android emulator and device release build

Output of react-native info

System: OS: macOS 11.6.1 CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz Memory: 56.03 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.2.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.13.0 - /usr/local/bin/npm Watchman: 2021.12.13.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /Users/tahara_satoshi/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: API Levels: 26, 27, 28, 29, 30, 31 Build Tools: 23.0.1, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.1, 28.0.3, 29.0.2, 30.0.2 System Images: android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Google Play Intel x86 Atom_64, android-S | Google APIs ARM 64 v8a, android-S | Google APIs Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.2/13C90 - /usr/bin/xcodebuild Languages: Java: 1.8.0_131 - /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 react-native-macos: Not Found npmGlobalPackages:

Issue and Reproduction Steps

I've upgraded react native on iOS branch to version 0.63.3 and merged android branch with react native version 0.59.8. I modified Android specific files manually by upgrade-helper and works fine with iOS debug build, release build and Android debug build. However only android release build crashes after launch app with react native version mismatch error.

npx react-native run-android --variant=release
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1738 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...

> Configure project :app
Reading env from: .env.production

> Configure project :@mauron85_react-native-background-geolocation-common
WARNING: The option 'android.enableUnitTestBinaryResources' is deprecated.
The current default is 'false'.
It has been removed from the current version of the Android Gradle plugin.
The raw resource for unit test functionality is removed.

> Configure project :react-native-firebase_admob
:react-native-firebase_admob package.json found at /Users/developer/Projects/sis/ReactNative/APP/node_modules/@react-native-firebase/admob/package.json
:react-native-firebase_app package.json found at /Users/developer/Projects/sis/ReactNative/APP/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_admob:ads.consent using default value: 1.0.6
:react-native-firebase_admob package.json found at /Users/developer/Projects/sis/ReactNative/APP/node_modules/@react-native-firebase/admob/package.json
:react-native-firebase_admob:version set from package.json: 11.5.0 (11,5,0 - 11005000)
:react-native-firebase_admob:android.compileSdk using custom value: 29
:react-native-firebase_admob:android.targetSdk using custom value: 29
:react-native-firebase_admob:android.minSdk using custom value: 24
:react-native-firebase_admob:reactNativeAndroidDir /Users/developer/Projects/sis/ReactNative/APP/node_modules/react-native/android

> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /Users/developer/Projects/sis/ReactNative/APP/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 26.8.0
:react-native-firebase_app:play.play-services-auth using default value: 19.0.0
:react-native-firebase_app package.json found at /Users/developer/Projects/sis/ReactNative/APP/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 11.5.0 (11,5,0 - 11005000)
:react-native-firebase_app:android.compileSdk using custom value: 29
:react-native-firebase_app:android.targetSdk using custom value: 29
:react-native-firebase_app:android.minSdk using custom value: 24
:react-native-firebase_app:reactNativeAndroidDir /Users/developer/Projects/sis/ReactNative/APP/node_modules/react-native/android

> Task :@react-native-community_netinfo:compileReleaseJavaWithJavac

> Task :@mauron85_react-native-background-geolocation-common:compileReleaseJavaWithJavac

> Task :app:generateReleaseBuildConfig
Reading env from: .env.production

> Task :@mauron85_react-native-background-geolocation:compileReleaseJavaWithJavac

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere

info Writing bundle output to:, /Users/developer/Projects/sis/ReactNative/APP/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/developer/Projects/sis/ReactNative/APP/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 241 asset files
info Done copying assets

> Task :react-native-community_toolbar-android:compileReleaseJavaWithJavac

> Task :react-native-device-info:compileReleaseJavaWithJavac

> Task :react-native-fbsdk-next:compileReleaseJavaWithJavac

> Task :react-native-firebase_app:compileReleaseJavaWithJavac

> Task :react-native-fs:compileReleaseJavaWithJavac

> Task :react-native-gesture-handler:compileReleaseJavaWithJavac

> Task :react-native-image-crop-picker:compileReleaseJavaWithJavac

> Task :react-native-image-resizer:compileReleaseJavaWithJavac

> Task :react-native-screens:compileReleaseJavaWithJavac

> Task :react-native-firebase_admob:compileReleaseJavaWithJavac

> Task :react-native-video:compileReleaseJavaWithJavac

> Task :react-native-webview:compileReleaseJavaWithJavac

> Task :rn-fetch-blob:compileReleaseJavaWithJavac

> Task :react-native-video-processing:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are: libffmpeg.so.

> Task :app:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are: libavcodec.so, libavformat.so, libavutil.so, libc++_shared.so, libfb.so, libfbjni.so, libffmpeg.so, libffmpeg_mediametadataretriever_jni.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-inspector.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsijniprofiler.so, libjsinspector.so, libnative-filters.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativejni.so, libswscale.so, libucrop.so, libyoga.so.

> Task :app:installRelease
Installing APK 'app-release.apk' on 'Pixel_4_Android_12_API_31(AVD) - 12' for app:release
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2m 21s
616 actionable tasks: 266 executed, 350 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.myapp/.MainActivity }

App was installed successfully but it crashes on launch. The error of Logcat message is below.

2021-12-15 18:25:17.189 30931-30931/? W/dex2oat64: Mismatch between dex2oat instruction set features to use (ISA: X86_64 Feature string: -ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) and those from CPP defines (ISA: X86_64 Feature string: ssse3,sse4.1,sse4.2,-avx,-avx2,popcnt) for the command line:
    /apex/com.android.art/bin/dex2oat64 --zip-fd=7 --zip-location=base.apk --oat-fd=8 --oat-location=/data/app/~~MXrpo1tQeuQoRbFspENeiA==/com.myapp-7t0eoFAWoyt7Sm3qwUCD_w==/oat/x86_64/base.odex --input-vdex-fd=-1 --output-vdex-fd=9 --swap-fd=10 --classpath-dir=/data/app/~~MXrpo1tQeuQoRbFspENeiA==/com.myapp-7t0eoFAWoyt7Sm3qwUCD_w== --class-loader-context=PCL[]{PCL[/system/framework/android.test.base.jar]} --compact-dex-level=none --instruction-set=x86_64 --instruction-set-features=default --instruction-set-variant=x86_64 --compiler-filter=speed-profile --compilation-reason=install --max-image-block-size=524288 --resolve-startup-const-strings=true --generate-mini-debug-info --runtime-arg -Xtarget-sdk-version:29 --runtime-arg -Xhidden-api-policy:enabled --runtime-arg -Xms64m --runtime-arg -Xmx512m
2021-12-15 18:25:20.431 31006-31006/? V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
2021-12-15 18:25:22.201 31006-31120/? E/ReactNativeJS: React Native version mismatch.

    JavaScript version: 0.59.8
    Native version: 0.63.3

    Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.
2021-12-15 18:25:22.273 31006-31126/? E/unknown:ReactNative: console.error: "React Native version mismatch.

    JavaScript version: 0.59.8
    Native version: 0.63.3

    Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.", stack:
    checkVersions@106:306
    <unknown>@105:63
    h@2:1670
    <unknown>@91:92
    h@2:1670
    d@2:868
    global code@1135:4

I've done these solutions below, but does not work.

rm -rf node_modules
rm -rf $TMPDIR/react-native-packager-cache-*
rm -rf $TMPDIR/metro-bundler-cache-*
yarn cache clean
yarn
yarn patch-package
watchman watch-del-all && react-native start --reset-cache
cd android/
./gradlew clean
vamper424 commented 2 years ago

![Uploading 16399552101846375569732433448716.jpg…]()

vamper424 commented 2 years ago

Is false.

El dom., 19 de diciembre de 2021 5:45 p. m., DIGITALSQUAD < @.***> escribió:

@vamper424 https://github.com/vamper424 What did you upload? I can't see your image since link is broken.

— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/32765#issuecomment-997498724, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARK2MXL7XUUJX6YUTWSJLKDURZ4ELANCNFSM5KDEKYJQ . You are receiving this because you were mentioned.Message ID: @.***>

cortinico commented 2 years ago

0.63.3

That's a really old version of RN. Have you tried updating to the latest? Also have you tried to reproduce this on a fresh RN project?

DIGITALSQUAD commented 2 years ago

@cortinico I'm trying to reproduce a fresh project on a new branch and merge components from the main branch into the branch, but it takes a long time to install and set up packages.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.