2

I am using material dialogs lib in my android application. I imported a module and this is lib gradle. I have already checked this thread could not find com.affolestad.material-dialogs but I have already thats suggested there. I don't know when I sync it then it looks for some other version of this lib. In build.gradle it is 0.9.4.7 but it looks for 0.8.6.2

module build.gradle

buildscript {
    repositories {
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta2'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
}

repositories {
    maven { url "https://jitpack.io" }
    jcenter()
}

dependencies {
    compille 'com.facebook.react:react-native:+'
    compille fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compille 'com.afollestad.material-dialogs:commons:0.9.4.7'
}

app build.gradle

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support:recyclerview-v7:26.0.1'
    compile 'com.facebook.react:react-native:+'
    // From node_modules
    implementation project(':react-native-dialogs')
}

Error

  Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
  > Could not find com.github.afollestad.material-dialogs:commons:0.8.6.2.
    Searched in the following locations:
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/google/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/google/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/android/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        file:/C:/Users/williams/AppData/Local/Android/sdk/extras/android/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        file:/C:/Program Files/Android/Android Studio Preview/gradle/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        file:/C:/Program Files/Android/Android Studio Preview/gradle/m2repository/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        https://dl.google.com/dl/android/maven2/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        https://dl.google.com/dl/android/maven2/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        https://jcenter.bintray.com/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        https://jcenter.bintray.com/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
        file:/D:/React Native/application/node_modules/react-native/android/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.pom
        file:/D:/React Native/application/node_modules/react-native/android/com/github/afollestad/material-dialogs/commons/0.8.6.2/commons-0.8.6.2.jar
    Required by:
        project :app > project :react-native-dialogs

I deleted .iml files, invalidated cache also that didn't work for me.

N Sharma
  • 33,489
  • 95
  • 256
  • 444
  • There is something strange. The library that it is looking for is com.github.afollestad.material-dialogs:commons not com.afollestad.material-dialogs:commons. – Gabriele Mariotti Aug 20 '17 at 08:10
  • @GabrieleMariotti Yep I couldn't manage to get it worked, weird. I went to some other alternatives – N Sharma Aug 21 '17 at 06:06
  • check the answer below. There is also a issue with the same answer: https://github.com/aakashns/react-native-dialogs/issues/62 – Gabriele Mariotti Aug 21 '17 at 06:42

2 Answers2

1

This issue doens't depend by

 compille 'com.afollestad.material-dialogs:commons:0.9.4.7'

Instead it depends by this line:

implementation project(':react-native-dialogs')

Checking in the github project you can find this dependency. It is an old module that is only on jitpack.

You have to include in your app/build.gradle

repositories {
    maven { url "https://jitpack.io" }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

You might have 3 choices:

  1. Delete '.gradle' folder from your project root folder and then try again.
  2. Force Android Studio to redownload dependencies: https://stackoverflow.com/a/29765077/6507689
  3. Make sure you have unchecked working offline: https://stackoverflow.com/a/22870183/6507689
R. Zagórski
  • 20,020
  • 5
  • 65
  • 90