facebook / react-native

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

[0.59.8] Android release build fails #24987

Closed perryhoekstra closed 5 years ago

perryhoekstra commented 5 years ago

React Native Environment Info: System: OS: macOS 10.14.5 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Memory: 1.74 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 23, 24, 26, 27, 28 Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.3 System Images: android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.8 => 0.59.8 npmGlobalPackages: react-native-cli: 2.0.1 Gradle: com.android.tools.build:gradle:3.4.1

Steps To Reproduce

1) Create new React-Native project: react-native init Acme 2) Open Acme project within Android Studio 3) Change Build Variant from debug to release

Describe what you expected to happen:

Android Studio would build an unsigned release *.apk file.

What actually happens:

Task :app:bundleReleaseJsAndAssets warning: the transform cache was reset. Loading dependency graph, done. error ENOENT: no such file or directory, open '/var/folders/pk/ghcf8fb90k7bpk_kkdgkcr28t9y1js/T/metro-cache/20/ff278d129e1cd5c490c10ed7b62f90b93800c13df7a07c6f26a9d561c05d9aaaad0412'. Run CLI with --verbose flag for more details.

Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 32s 1 actionable task: 1 executed ERROR: Process 'command 'node'' finished with non-zero exit value 1

dulmandakh commented 5 years ago

you must use Android Gradle plugin 3.3.x with 0.59.x. 0.60 will support Android Gradle Plugin 3.4.x.

perryhoekstra commented 5 years ago

dulmandakh: I tried multiple versions of the Android Gradle plugin, including 3.3.1 and 3.3.0 with no success. So, I don't believe this issue should be closed.

zhifeng-heng commented 5 years ago

Hi all, i am facing the exact same issue.

Environment:

Anyone have any solution so far?

GospelHW commented 5 years ago

same bug

GospelHW commented 5 years ago

React Native Environment Info: System: OS: macOS 10.14.4 CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz Memory: 81.60 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.6.0 - /usr/local/bin/node npm: 6.7.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 22, 23, 24, 25, 26, 27, 28 Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.3 System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs ARM 64 v8a, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-Q | Google APIs Intel x86 Atom IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.8 => 0.59.8 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

GospelHW commented 5 years ago

@dulmandakh Hi how can i do? pls help me,thx

nikopolidi commented 5 years ago

@dulmandakh same issue:

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'android/app/build/generated/assets/react/release/index.android.bundle.map''

Gradle Scan output (absolute app path replaced with {APP_PATH})

A problem occurred starting process 'command '{APP_PATH}/android/app/build/generated/assets/react/release/index.android.bundle.map''
> Could not start '{APP_PATH}/android/app/build/generated/assets/react/release/index.android.bundle.map'
  > Cannot run program "{APP_PATH}/android/app/build/generated/assets/react/release/index.android.bundle.map" (in directory "{APP_PATH}"): error=2, No such file or directory
    > error=2, No such file or directory
daominhsangvn commented 5 years ago

Why this closed? I got the same issue, here my environment:

React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
      Memory: 2.62 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 9.11.2 - ~/.nvm/versions/node/v9.11.2/bin/node
      Yarn: 1.13.0 - ~/.nvm/versions/node/v9.11.2/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v9.11.2/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 27.0.1, 27.0.3, 28.0.0, 28.0.3
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1
    Project Gradle: 
      distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
      buildScript: com.android.tools.build:gradle:3.4.1
nikopolidi commented 5 years ago

I solved that issue by creating fresh app with ‘react-native init’ and configuring release build type. Then I was installing latest version of every dependency that has to be linked, one by one with assembleRelease after each. As result I figured that there are 2 dependencies using older android API level <24 when 28 is defined with rootProject.ext... ‘react-native-smart-splash-screen’ ‘react-native-thumbnail’ Build was successful after unlinking and remove bing these modules

ranjanrukhaya-gommt commented 5 years ago

Facing this issue with release build but works abs fine in debug build.

Environment ::

Is it some proguard issue or gradle one ?

ferostabio commented 5 years ago

Since this issue is still closed, devs aren't answering and I'm still experiencing the issue even after attempting a number of version alternatives, including the just released 0.60.0, I created a new issue.