Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find com.parse.bolts:bolts-android:1.1.2. in phone gap project (android studio)?

I am new in phone gap.integrated facebook plugin in my project .after running error showing

`Error:A problem occurred configuring root project 'android'.'

Could not resolve all dependencies for configuration ':_debugCompile'. Could not find com.parse.bolts:bolts-android:1.1.2. Searched in the following locations: file:/C:/Users//AppData/Local/Android/sdk/extras/android/m2repository/com/parse/bolts/bolts-android/1.1.2/bolts-android-1.1.2.pom file:/C:/Users//AppData/Local/Android/sdk/extras/android/m2repository/com/parse/bolts/bolts-android/1.1.2/bolts-android-1.1.2.jar file:/C:/Users//AppData/Local/Android/sdk/extras/google/m2repository/com/parse/bolts/bolts-android/1.1.2/bolts-android-1.1.2.pom file:/C:/Users//AppData/Local/Android/sdk/extras/google/m2repository/com/parse/bolts/bolts-android/1.1.2/bolts-android-1.1.2.jar Required by: :android:unspecified > com.facebook.android:FacebookLib:3.21.1

pls help me.

import java.util.regex.Pattern

apply plugin: 'android'

buildscript {
repositories {
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    compile 'com.parse.bolts:bolts-android:1.1.2'


}
}

ext.multiarch=false

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
for (subproject in getProjectList()) {
    compile project(subproject)
}
compile files('com.phonegap.plugins.facebookconnect/FacebookLib/libs/bolts-android-1.1.2.jar')
}

android {
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
}

defaultConfig {
    versionCode Integer.parseInt("" + getVersionCodeFromManifest() + "0")
}

compileSdkVersion 19
buildToolsVersion "19.1.0"

if (multiarch || System.env.BUILD_MULTIPLE_APKS) {
    productFlavors {
        armv7 {
            versionCode defaultConfig.versionCode + 2
            ndk {
                abiFilters "armeabi-v7a", ""
            }
        }
        x86 {
            versionCode defaultConfig.versionCode + 4
            ndk {
                abiFilters "x86", ""
            }
        }
        all {
            ndk {
                abiFilters "all", ""
            }
        }
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

}

task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}

def getVersionCodeFromManifest() {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
return Integer.parseInt(matcher.group(1))
}

def getProjectList() {
def manifestFile = file("project.properties")
def pattern = Pattern.compile("android.library.reference.(\\d+)\\s*=\\s*(.*)")
def matcher = pattern.matcher(manifestFile.getText())
def projects = []
while (matcher.find()) {
  projects.add(":" + matcher.group(2).replace("/",":"))
}
return projects
}
like image 308
praj Avatar asked Jan 04 '15 08:01

praj


2 Answers

Try it may be helpful.

Failed to resolve : compile 'com.parse.bolts:bolts-android:1.+'

Go to menu : File -> Settings - > Build, Execution, Deployment - > Build Tools -> Gradle

In - Project-level-setting

Checked or select- User default gradle wrapper(recommended)

and

In - Global Gradle Setting

Disable offline Work

like image 89
Mansukh Ahir Avatar answered Nov 13 '22 20:11

Mansukh Ahir


You're missing the repositories declaration in your script. What you do have is the repositories in buildscript closure, that configures the build itself (e.g. to find the Android plugin needed for the build to run), but you don't have a repositories declaration that will bring the dependencies your classes need. Please add

repositories {
   jcenter()
}

That should do the trick.

like image 24
JBaruch Avatar answered Nov 13 '22 19:11

JBaruch