错误:(41,0)提供的字符串模块符号'0.12.2'无效 [英] Error:(41, 0) Supplied String module notation '0.12.2' is invalid

查看:163
本文介绍了错误:(41,0)提供的字符串模块符号'0.12.2'无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Eclipse项目导入Android Studio,并且在导入项目时遇到以下错误:

I am importing Eclipse project into Android studio and while importing the project getting following error:

Error:(41, 0) Supplied String module notation '0.12.2' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.
Open File

这是我的build.gradle文件:

Here is my build.gradle file:

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':appcompat')
    compile project(':cardview')
}

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.0'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
        }

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

buildscript {
    dependencies {
        classpath '0.12.2'
    }
    repositories {
        mavenCentral()
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}

我在以下一行上遇到错误:

I am getting error on the following line:

classpath '0.12.2'

推荐答案

您的脚本似乎很旧.

您应将行 classpath'0.12.2'更改为:

classpath 'com.android.tools.build:gradle:0.12.2'

我希望这个脚本应该还有其他问题.

I am expecting that this script should have some other issues.

  • 将您的Android Studio更新到最新的稳定版本(2.1)
  • 使用 apply插件:'com.android.application'
  • 使用 classpath'com.android.tools.build:gradle:2.1.0'
  • 使用 distributionUrl = https \://services.gradle.org/distributions/gradle-2.10-all更新gradle版本( gradle/wrapper/gradle-wrapper.properties ).邮编

这篇关于错误:(41,0)提供的字符串模块符号'0.12.2'无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆