react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Could not resolve all files for configuration error while setup in android

Open prateek3255 opened this issue 8 years ago • 15 comments

I followed all the steps as stated in the android installation guide but still, I am continuously facing this error

Could not resolve all files for configuration ':react-native-firebase:debugCompileClasspath'.
> Could not find firebase-messaging.jar (com.google.firebase:firebase-messaging:15.0.2).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.2/firebase-messaging-15.0.2.jar
> Could not find multidex.jar (com.android.support:multidex:1.0.2).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.jar
> Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.3).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.3/runtime-1.0.3.jar

Here are my build.gradle files look something just like this -

android/build.gradle


buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.1'

        // 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"
        }
        google()
    }
}

android/app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile



project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 27


    defaultConfig {
        applicationId "com.enappd.teleflix"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
           
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile(project(':react-native-firebase')) {
        transitive = false
    }
    // implementation project(':react-native-firebase')
    compile project(':react-native-splash-screen')
    compile project(':react-native-video')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:27.0.2"
    compile "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.google.android.gms:play-services-base:15.0.0"
    implementation "com.google.firebase:firebase-core:15.0.2"
}


task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
apply plugin: 'com.google.gms.google-services'


I have gone through the issues of people facing similar bugs but still nothing seems to be working out.

Thanks for the help in advance ;)

Issue

Environment

  1. Application Target Platform: Android
  1. Development Operating System: Windows 10
  1. Build Tools: Android Studio 3.0
  1. React Native version: 0.55.4
  1. RNFirebase Version: 4.2.0
  1. Firebase Module: N/A

prateek3255 avatar Jun 08 '18 18:06 prateek3255

I am running into the same issue

gaschneidr avatar Jun 08 '18 19:06 gaschneidr

I fixed this error after some few changes, don't know which one had the actual impact though. Here are my gradle files:

project/build.gradle

buildscript {
    repositories {
        google() 
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
            
            // jitpack repo is necessary to fetch ucrop dependency
            maven { url "https://jitpack.io" }
        }
    }
}

Apparently moving the google() to the top of the repositories fixes some issues I was facing, according to this answer. It did for me.

project/app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.affinitysw"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation(project(':react-native-firebase')) {
        transitive = false
    }
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-wheel-datepicker')
    implementation project(':react-native-image-crop-picker')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation 'com.google.firebase:firebase-core:15.0.2'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

As I said, I don't know exactly what made it work, but I hope it helps you!

gaschneidr avatar Jun 08 '18 20:06 gaschneidr

@gabsschneider thank you!

for me the line with "com.google.android.gms:play-services-base:15.0.1" from file project/app/build.gradle needed to be replaced. That's what f*cked up my project.

Thank You!

cristianonescu avatar Jun 08 '18 21:06 cristianonescu

Thank you! @gabsschneider It worked for me!

prateek3255 avatar Jun 09 '18 07:06 prateek3255

@cristianonescu @prateek3255 you're welcome!

gaschneidr avatar Jun 09 '18 11:06 gaschneidr

Thank You!!! @gabsschneider I had the same issue!

DMRE avatar Jun 10 '18 06:06 DMRE

Hi, I am also trying to add the react-native-firebase but looking at this example https://rnfirebase.io/docs/v4.3.x/auth/phone-auth#signInWithPhoneNumber I am not sure where to add firebase configuration

var config = { apiKey: "<API_KEY>", authDomain: "<PROJECT_ID>.firebaseapp.com", databaseURL: "https://<DATABASE_NAME>.firebaseio.com", projectId: "<PROJECT_ID>", storageBucket: ".appspot.com", messagingSenderId: "<SENDER_ID>", }; firebase.initializeApp(config);

Can you please tell me the steps to do PhoneNumber authentication?

thank you

badarshahzad avatar Aug 03 '18 11:08 badarshahzad

Thanks @gabsschneider !! Moving the google() to the top of the repositories fixed my issue.

yairopro avatar Sep 25 '18 19:09 yairopro

Thanks @gabsschneider It worked for me!

ricarrrdoaraujo avatar Oct 23 '18 18:10 ricarrrdoaraujo

Was facing the same issue, This solution worked for me. Thanks @gabsschneider!

hridaymodi avatar Oct 25 '18 18:10 hridaymodi

Thanks @gabsschneider !! Moving the google() to the top of the repositories fixed my issue.

dont know why this works for me and im surprised

ZainabShakeel avatar Aug 17 '21 15:08 ZainabShakeel

Execution failed for task ':app:mergeDebugResources'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find com.google.andriod.material:material:1.1.0.

Hello everyone ! I'm getting this error can someone help me how to resolve this i'm beginner. Thanks

MUNTAHA-AABDANI avatar Aug 17 '21 18:08 MUNTAHA-AABDANI

@Muntaha-Aabdani Hi there - this is rare, it looks like that one was never actually released. I just googled for and looked at mvnrepository.com (a good source to check dependencies) and it appears that 1.1.0 went to rc2 but was never released, and 1.4.0 is the current version.

Try 1.4.0 https://mvnrepository.com/artifact/com.google.android.material/material

mikehardy avatar Aug 17 '21 18:08 mikehardy

@Muntaha-Aabdani Hi there - this is rare, it looks like that one was never actually released. I just googled for and looked at mvnrepository.com (a good source to check dependencies) and it appears that 1.1.0 went to rc2 but was never released, and 1.4.0 is the current version.

Try 1.4.0 https://mvnrepository.com/artifact/com.google.android.material/material

Thank u its not working can u plz send me proper link so that i can use it in my project.

MUNTAHA-AABDANI avatar Aug 17 '21 18:08 MUNTAHA-AABDANI

@mikehardy

Build file 'C:\Users\Muntaha Aabdani\AndroidStudioProjects\ToDoListApp\app\build.gradle' line: 43

A problem occurred evaluating project ':app'.

Supplied String module notation '// https://mvnrepository.com/artifact/com.google.android.material/material runtimeOnly group: 'com.google.android.material', name: 'material', version: '1.4.0-beta01' ' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I'm getting this error can u help me?

MUNTAHA-AABDANI avatar Aug 17 '21 19:08 MUNTAHA-AABDANI