Android-studio Unresolved 依赖 : android-maps-utils

标签 android gradle android-studio build.gradle

我正在使用 android-studio 0.6.1 并在 SDK 管理器中安装了所有必要的 google 存储库:但是当我尝试构建项目时,gradle 说 Unresolved 依赖项:

Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+

我的 build.gradle 看起来像这样:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.11.+'

    }
}
apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 12
        targetSdkVersion 19
        versionCode 1
        versionName '0.1'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile project(':library')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.maps.android:android-maps-utils:+'
}

我知道我可以在库文件夹中导入所有必要的乐器,但是我想解决这个问题。你有什么建议吗?

编辑:
找到了解决方法:
看起来问题是不存在的
compile 'com.android.support:support-v4:19.0.1'

在 build.gradle 中,我还必须清空“库”文件夹并删除该行以避免支持库出现“重复包”问题:
compile project(':library')

所以我最终的 build.gradle 文件如下所示:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.11.+'

    }
}
apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 12
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }

    repositories {
        mavenCentral()
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:4.4+'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.3+'

}

最佳答案

错误是

Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+

我会说仔细检查您是否正确定义了依赖项。看着Map Utils website让我相信你可能想用一个版本来声明依赖。

代替
compile 'com.google.maps.android:android-maps-utils:+'

compile 'com.google.maps.android:android-maps-utils:0.3+'
做一个Gradle Sync一切都应该正确构建。

关于Android-studio Unresolved 依赖 : android-maps-utils,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24287445/

相关文章:

java - fragment 未完全膨胀

java - Android 构建在 AppCenter 上失败,但在 Android Studio 上构建良好

android-studio - 我们需要为Android Studio启用哪些链接?

android - 如何在 Android Studio 中重命名包?

android - 扩展SearchActionItem而不添加到backstack

android - __android_log_print 输出 '/n' 换行 CR

java - 缺少 Android 操作栏和菜单选项

android-studio - GradleException : Crashlytics could not determine stripped/unstripped native library directories

Android Spinner 是由魔法触发的

java - CommandInvokationFailure:Gradle构建失败。打开JDK错误