如何在Anko中调试“无法解析com.google.android:android”错误

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 

安装Android Studio 2.4 Preview时出现同样的错误。 只要确保你的项目级别的build.gradle看起来像这样

 // 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" } } 

删除线

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

请再试一次。 或者粘贴完整的build.gradle。

maven {url'https: //maven.google.com '}至maven {url“ https://dl.google.com/dl/android/maven2/ ”}