facebook / react-native

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

Error while run with okhttp-ws-compact #14223

Closed icrotz closed 7 years ago

icrotz commented 7 years ago

JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug...

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 19.4 secs Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html

david50407 commented 7 years ago

same problem here

$ ./gradlew clean assembleDebug
Incremental java compilation is an incubating feature.
File /home/davy/.android/repositories.cfg could not be loaded.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-youtube'.
      > Could not resolve all dependencies for configuration ':react-native-youtube:_debugPublishCopy'.
         > Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1.
           Required by:
               App:react-native-youtube:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 9.184 secs
icrotz commented 7 years ago

Do you use Deco IDE ?

gShrey commented 7 years ago

+1. This is occurring for RN 0.42 in android only. Apparently, on jcenter repo, a new release of react native was added today with version 0.42.3-atlassian-1 which seem to be breaking 0.42.

See https://bintray.com/bintray/jcenter/com.facebook.react%3Areact-native

I am not well versed android build process, but that seems to be reason. Meanwhile, I am looking to find workaround and reporting this release at bintray who maintains jcenter.

If someone have good understanding of jcenter and gradle process. Please suggest a workaround.

david50407 commented 7 years ago

@icrotz no, I didn't use any IDE for editing or project management.

I'm using RN 0.36, but this caused by all packages that has dependency below:

compile 'com.facebook.react:react-native:+' // from node_module
gShrey commented 7 years ago

@david50407 yes, compile 'com.facebook.react:react-native:+' is causing problem .

icrotz commented 7 years ago

no it's fixed for me ^^i just need to create the project manually before using Deco IDE

icrotz commented 7 years ago

@facebook-github-bot answered

gShrey commented 7 years ago

@icrotz is your android build is working fine? Did you changed rn version? We are using microsoft mobile center to create builds and those are failing as well.

david50407 commented 7 years ago

After RN 0.20, ReactNative is delivered with js package (node_module/react-native/android) and loaded locally (by requiring react-native:+). And the public repository keeps version on 0.20, so any version newer than 0.20 at local will be used.

But the version uploaded today (0.42.3-atlassian-1) is newer than 0.42.3, so any version lower than 0.42.3 will get this issue.

loveacat commented 7 years ago

same problem rn 0.39.2

david50407 commented 7 years ago

Since gradle doesn't support declaring repositories on a per-artifact basis yet.

I modified my build.gradle (not app/build.gradle) to force all dependency to react-native to specific version:

  allprojects {
     configurations.all {
       resolutionStrategy {
         eachDependency { DependencyResolveDetails details ->
           if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
             details.useVersion "0.36.0" // Your real React Native version here
           }
         }
       }
     }
  }

You can get the react native version by ls node_modules/react-native/android/com/facebook/react/react-native/, and it will shows the version that delivered with current npm package.

gShrey commented 7 years ago

@david50407 Thanks for solution. I have created separate issue #14225 for better visibility of main issue. This change seems to be breaking all older versions app.

david50407 commented 7 years ago

@gShrey s/#14425/#14225/ .

bestotem commented 7 years ago

I have the same issue , rn 0.42

xwartz commented 7 years ago

@david50407 It dosen't work for me.

karthiknrbt commented 7 years ago

I' am using RN version 0.30. I' am facing the same issue.

david50407 commented 7 years ago

@xwartz still same problem? Did you inject that fix code into android/build.gradle (not android/app/build.gradle), and change the version to your local react-native version?

brentvatne commented 7 years ago

closing this in favor of the more descriptive #14225

samahHammad commented 7 years ago

I'm using RN 0.26.0 and facing the same issue, after trying the above solution I got the following

A problem occurred configuring project ':RCTVideo'.

Could not resolve all dependencies for configuration ':RCTVideo:_debugCompile'. Could not find com.facebook.react:react-native:0.26.0. Searched in the following locations: file:/C:/Users/DELL/.m2/repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom file:/C:/Users/DELL/.m2/repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar https://repo1.maven.org/maven2/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom https://repo1.maven.org/maven2/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar https://jcenter.bintray.com/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom https://jcenter.bintray.com/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar file:/E:/RN/1/node_modules/node_modules/react-native/android/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom file:/E:/RN/1/node_modules/node_modules/react-native/android/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar file:/C:/Users/DELL/AppData/Local/Android/sdk/extras/android/m2repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom file:/C:/Users/DELL/AppData/Local/Android/sdk/extras/android/m2repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar file:/C:/Users/DELL/AppData/Local/Android/sdk/extras/google/m2repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.pom file:/C:/Users/DELL/AppData/Local/Android/sdk/extras/google/m2repository/com/facebook/react/react-native/0.26.0/react-native-0.26.0.jar Required by: QCAndroidFull:RCTVideo:unspecified

I'm sure of RN version that I'm using and React-native-video is installed and was working fine before this issue

Any Advice?

xwartz commented 7 years ago

@david50407 Yes, but it caused another issue. react-native-chart-android can't import com.facebook.react.uimanager.ReactPropGroup

poupryc commented 7 years ago

Hello everyone,

Same error here:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-vector-icons'.
      > Could not resolve all dependencies for configuration ':react-native-vector-icons:_debugPublishCopy'.
         > Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1.
           Required by:
               myAwesomeAppThatPutsHappinessInYourHeart:react-native-vector-icons:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

v: 0.42.0

poupryc commented 7 years ago

@david50407 your fix work for me... for the moment ^^

ghost commented 7 years ago

It work for me, thank you ! @david50407

weidaxu1988 commented 7 years ago

@david50407 you saved me

carolineplanet commented 7 years ago

Hi!

Anybody could put an example of the whole build.gradle file? I don't know how to insert @david50407's code

allprojects { configurations.all { resolutionStrategy { eachDependency { DependencyResolveDetails details -> if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') { details.useVersion "0.36.0" // Your real React Native version here } } } } }

Thank you!

rohan-sethi commented 7 years ago

@carolineplanet this worked for me

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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"
        }

        configurations.all {
            resolutionStrategy {
                eachDependency { DependencyResolveDetails details ->
                    if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
                        details.useVersion "0.42.0" // Your real React Native version here
                    }
                }
            }
        }
    }
}
punksta commented 7 years ago

you can read version from gradle file directly, no need of putting it manually.

 configurations.all {
        resolutionStrategy {
            eachDependency { DependencyResolveDetails details ->
                if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
                    def file = new File("$rootDir/../node_modules/react-native/package.json")
                    def version = new groovy.json.JsonSlurper().parseText(file.text).version
                    details.useVersion version
                }
            }
        }
    }
carolineplanet commented 7 years ago

Thank you @rohan-sethi! You saved my day!

ghost commented 7 years ago

@punksta Perfect!!!

libetl commented 7 years ago

This looks like a mistake : https://bintray.com/bintray/jcenter/com.facebook.react%3Areact-native/0.42.3-atlassian-1 Am I right ?

david50407 commented 7 years ago

@libetl yes, IMO, this could be a mistake from CI/CD that pushed this version to public repository accidentally.

rushabh1191 commented 7 years ago

@david50407 It worked with me! But my dependency project is breaking, it is not being able to find the provided react-native version. Any hack on that? I am using https://github.com/xinthink/react-native-material-kit.

skyride99 commented 7 years ago

@david50407Thanks... that worked

arunkumarrmrj commented 7 years ago

"com.atlassian.mobile.video" is not avaible on maven right now. To run your project you need to update it

Update your react and react-native version to in your package.json file

"react": "16.0.0-alpha.3",
"react-native": "0.43.1",

Then remove node_modules and do a npm install again

Let me know if it works for you

GurtejSafaltek commented 7 years ago

@david50407 Thanks its working for me šŸ‘

kaberibasu commented 7 years ago

@david50407 @rohan-sethi @punksta thankx a lot for the solution. saved my app.

lanhmomo commented 7 years ago

Its not work for me. My rn 0.42.3 Any help, please! Error:A problem occurred configuring project ':react-native-code-push'.

Could not resolve all dependencies for configuration ':react-native-code-push:_debugPublishCopy'. Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1. Required by: momo-v2-dgd:react-native-code-push:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

poupryc commented 7 years ago

Hey @lanhmomo, try to switch to React Native 0.43.4, it's working fine for me šŸ˜„

osama9 commented 7 years ago

@rohan-sethi Thank you, your solution worked for me.

lanhmomo commented 7 years ago

@HelloEdit I'm trying to up react to 0.43.4. Thank you!

SathishSundharam commented 7 years ago

Thankyou both.@david50407 @rohan-sethi

lanhmomo commented 7 years ago

allprojects { repositories { mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm // Because some dependencies are differently nested url "$projectDir/../../../node_modules/react-native/android" } maven { // Because some other dependencies are nested in yet another way url "$projectDir/../../../../node_modules/react-native/android" } }

buildscript {
    repositories {
        jcenter()
    }
}

} buildscript { dependencies {

}

} @rohan-sethi Thank you! I keep react-native version 0.42.3 and update maven above. It working for me!

guerrysemones commented 7 years ago

david50407 That worked. Much thanks.

shashuec commented 7 years ago

I solved this by updating the react-native version using: https://facebook.github.io/react-native/docs/upgrading.html and https://github.com/facebook/react-native/issues/11578

rajatgupta1993 commented 6 years ago

`
A problem occurred configuring root project 'FirstProject'.

Could not resolve all dependencies for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:2.2.3. Required by: :FirstProject:unspecified Could not resolve com.android.tools.build:gradle:2.2.3. Could not get resource 'https://jcenter.bintray.com/com/android/tools /build/gradle/2.2.3/gradle-2.2.3.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build /gradle/2.2.3/gradle-2.2.3.pom'. Received status code 407 from server: Proxy Aut hentication Required`

I am getting this error when I try to run react-native run-android on my default react native project. I have added the code suggested by @david50407 in my build.gradle file. I am running it via my organisation proxy .

Also what does Received status code 407 from server: Proxy Authentication Required means?

For proxy setting I have added following lines in my gradle.properties :

systemProp.http.proxyPort=80
systemProp.http.proxyUser=ra****
systemProp.https.auth.ntlm.domain=******
systemProp.http.proxyPassword=******

systemProp.https.proxyPassword=******
systemProp.https.proxyHost=******
systemProp.http.auth.ntlm.domain=*****
systemProp.http.proxyHost=******
systemProp.https.proxyPort=80
systemProp.https.proxyUser=ra***