2016-04-28 80 views
2

我導入Eclipse項目的Android進入工作室,在導入項目獲得以下錯誤:錯誤:(41,0)提供的字符串模塊符號「0.12.2」無效

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 

這裏是我的版本。 gradle這個文件:

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() 
    } 
} 

我在下面的行收到錯誤:

classpath '0.12.2' 

回答

3

你的腳本似乎是很老。

你應該改變行classpath '0.12.2'有:

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

我期待這個腳本應該有一些其他的問題。

  • 更新Android工作室到最新的穩定版本(2.1)
  • 使用apply plugin: 'com.android.application'
  • 使用classpath 'com.android.tools.build:gradle:2.1.0'
  • 更新版本的Gradle(gradle/wrapper/gradle-wrapper.properties)與distributionUrl = https\://services.gradle.org/distributions/gradle-2.10-all.zip
相關問題