Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error when run react-native run-android

A problem occurred configuring project ':app'.    > Could not resolve all dependencies for configuration ':app:_debugApk'.      > A problem occurred configuring project ':react-native-fbsdk'.        > Could not resolve all dependencies for configuration ':react-native-fbsdk:_debugPublishCopy'.          > Could not find com.android.support:appcompat-v7:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified          > Could not find com.android.support:appcompat-v7:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.react:react-native:0.46.4          > Could not find com.android.support:support-annotations:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0          > Could not find com.android.support:support-core-utils:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0          > Could not find com.android.support:appcompat-v7:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0          > Could not find com.android.support:cardview-v7:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0          > Could not find com.android.support:customtabs:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0          > Could not find com.android.support:support-v4:27.0.1.            Searched in the following locations:              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom              file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar              file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar            Required by:              beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0 

compileSdkVersion 25

buildToolsVersion "25.0.0"

targetSdkVersion 25

like image 560
Anant kamat Avatar asked Dec 06 '17 09:12

Anant kamat


People also ask

How do I run a release build in React Native?

Hint: You can also use the React Native CLI to generate and run a Release build (e.g. npx react-native run-android --variant=release ). You can also iterate quickly on a device by connecting to the development server running on your development machine.

How do I run a react app on Android?

Run your app Type the following in your command prompt to install and launch your app on the device: $ npx react-native run-android Select your project in the Xcode Project Navigator, then select your main target (it should share the same name as your project).

How to debug React-Native run-Android on Android?

if "npx react-native run-android" is not working goto "package.jason" file and look over "scripts" debugger is there. clicking on debugger gives you options on top of the screen. select"react-native run-android". Show activity on this post. You have to update your npm version...

Why does react native init not work with Gradle?

This happens because react-native init is always shipping the latest version of Gradle to your android project, and third party libraries might not have support for that Gradle version, making your Gradle version incompatible with the library. What you need to do is install a earlier version of Gradle for your project and then rebuild your app.


2 Answers

The accepted answer does the trick but a cleaner solution would be to restrict the android fbsdk version used in the react native fbsdk library. Adding the below code to project(root) build.gradle made sure that the specified version of fbsdk is used by all library projects.

allprojects {     repositories {         ...         configurations.all {             resolutionStrategy {                 force 'com.facebook.android:facebook-android-sdk:4.28.0'             }         }     } } 
like image 155
Akhil Avatar answered Sep 24 '22 08:09

Akhil


I've faced the same issue today.

Looks like there is some problem with react-native-fbsdk package;

I've found the only way to solve it for now:

at node_modules/react-native-fbsdk/android/build.gradle

change compile('com.facebook.android:facebook-android-sdk:4+')

to compile('com.facebook.android:facebook-android-sdk:4.26.0')

This is very bad solution.

If you will find proper way to solve it - please share.

like image 30
Валентин Галкин Avatar answered Sep 23 '22 08:09

Валентин Галкин