何权利
何权利

Reputation: 31

How to debug the "Could not resolve com.google.android:android" error in Anko

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
//Anko
compile "org.jetbrains.anko:anko:$anko_version"
compile "org.jetbrains.anko:anko-coroutines:$anko_version"
compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.13'

Build error:

Error:Failed to resolve: Could not resolve    
 com.google.android:android:2.3.1.

Required by:  
    project :app > org.jetbrains.kotlinx:kotlinx-coroutines-android:0.13

Upvotes: 0

Views: 546

Answers (3)

user8096280
user8096280

Reputation: 1

maven { url 'https://maven.google.com' } to maven {url "https://dl.google.com/dl/android/maven2/"}

Upvotes: 0

Dmytro Rostopira
Dmytro Rostopira

Reputation: 11185

I've got same error when installed Android Studio 2.4 Preview. Just make sure, your project-level build.gradle looks like this

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.1.2-3'
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1' //Version must be exactly 2.3.1
        classpath 'com.google.gms:google-services:3.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

Upvotes: 1

civic.LiLister
civic.LiLister

Reputation: 2197

Remove the line

compile "org.jetbrains.anko:anko-coroutines:$anko_version"

and try again, please. Or paste the full build.gradle.

Upvotes: 0

Related Questions