facebook / react-native

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

Cannot build for android (Could not find react-native.jar) #24656

Closed dengwei729 closed 5 years ago

dengwei729 commented 5 years ago

🐛 Bug Report

* What went wrong:
Could not resolve all files for configuration ':react-native-fetch-blob:releaseCompileClasspath'.
> Could not find react-native.jar (com.facebook.react:react-native:0.59).
  Searched in the following locations:
      http://mvnrepo.alibaba-inc.com/mvn/repository/com/facebook/react/react-native/0.59/react-native-0.59.jar

there is not react-native.jar since react-native ver 0.29

To Reproduce

100%

Expected Behavior

build sucessfully

Code Example

compile "com.facebook.react:react-native:+"  // From node_modules

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 40.41 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.6.0 - /usr/local/bin/node
      Yarn: 1.15.2 - ~/.yarn/bin/yarn
      npm: 5.5.1 - /usr/local/bin/npm
      Watchman: 4.7.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 22, 23, 24, 25, 26, 27
        Build Tools: 23.0.1, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 27.0.2, 27.0.3
        System Images: a...google_apis | Google APIs Intel x86 Atom Sys..., a...s_playstore | Google Play Intel x86 Atom Sys...
    IDEs:
      Android Studio: 3.1 AI-173.4720617
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.0.0-alpha.12 => 16.0.0-alpha.12
      react-native: 0.56.0 => 0.56.0
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-update-cli: 0.1.0
dengwei729 commented 5 years ago

has try command below, not work

yarn clean
yarn cache clean
rm -rf node_modules/ && yarn
react-native-bot commented 5 years ago

It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.
dengwei729 commented 5 years ago

@react-native-bot

find react-native.jar from node_modules firstly, if not, find from the maven;

Why find react-native.jar, there\s not react-native.jar yet。 There is only react-native.aar in node_modules or maven.

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven { url "http://mvnrepo.alibaba-inc.com/mvn/repository" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

        // ADD THIS
        maven { url 'https://maven.google.com' }

        // ADD THIS
        maven { url "https://jitpack.io" }
    }
}
dulmandakh commented 5 years ago

@dengwei729 could you please try to below setup

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

        // ADD THIS
        maven { url 'https://maven.google.com' }

        // ADD THIS
        maven { url "https://jitpack.io" }
        maven { url "http://mvnrepo.alibaba-inc.com/mvn/repository" }
    }
}
react-native-bot commented 5 years ago

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

jinhongyu156 commented 5 years ago

@dengwei729 Have you solved the problem yet? If so, how did you do it.

ananyacleetus commented 4 years ago

Likewise bitmoji