문제

I am trying to include Otto library in my project, but am getting this error:

> Could not resolve all dependencies for configuration ':maptest:_debugCompile'.
> Could not find com.squareup:otto:1.3.4.

I have tried cleaning project, running Tools -> android -> sync project with gradle files but that gives me the same error.

My build.gradle is the following:

buildscript {
repositories {
    mavenCentral()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:0.7.+'
    }
}

apply plugin: 'android'

android {
compileSdkVersion 18
buildToolsVersion "18.0.1"

defaultConfig {
    minSdkVersion 8
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
    }
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:19.0.1'
    compile 'com.google.android.gms:play-services:4.1.32'
    compile 'com.squareup:otto:1.3.4'
}
도움이 되었습니까?

해결책

You should add maven central repository, so gradle know where so search for library.

repositories {
    mavenCentral()
}

다른 팁

Did you import Otto library into Android Private Libraries? Try clean project this way: Project -> Clean...

You may check this out.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top