该项目可能正在使用不包含方法'compileSdkVersion()'的Gradle版本

Neo*_*oVe 14 eclipse android gradle android-studio

在尝试运行最初在Eclipse ADT上创建的项目时,我遇到了这个问题.

Error:(17, 0) Gradle DSL method not found: 'compileSdkVersion()'
Possible causes:<ul><li>The project 'TaxiAndroidOpen-master' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
Run Code Online (Sandbox Code Playgroud)

我已将此转换为Android Studio gradle系统.

但我无法运行它,也无法编译它,因为这个错误,这里是生成的gradle:

// Top-level build file where you can add configuration options common to  all sub-projects/modules.
buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
   }
}
allprojects {
repositories {
    jcenter()
   }
}

ext {
compileSdkVersion 17
buildToolsVersion '18.1.0'
}
dependencies {
}
Run Code Online (Sandbox Code Playgroud)

我在SO上发现了一些其他帖子,但有类似的错误,但没有人有这个特定的帖子.

我正在使用Android Studio 1.0.2,x86.

有人可以对此有所了解吗?

提前致谢!

编辑

更新了build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 17
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.opentaxi.android"
    minSdkVersion 9
    targetSdkVersion 19
}

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

dependencies {
compile project(':comtaxibulgariamap_mapsforge_044201406271417533')
compile files('libs/littlefluffylocationlibrary_r15.jar')
}
Run Code Online (Sandbox Code Playgroud)

Moh*_*ngh 15

您的应用程序模块的build.gradle文件应如下所示.

apply plugin: 'com.android.application'

android {
   compileSdkVersion 17
   buildToolsVersion "21.1.2"

defaultConfig {
     applicationId "com.opentaxi.android"
     minSdkVersion 9
     targetSdkVersion 19
  }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {

    compile project(':comtaxibulgariamap_mapsforge_044201406271417533')
    compile fileTree(include: ['*.jar'], dir: 'libs')
}
Run Code Online (Sandbox Code Playgroud)

如果在发布时存在,则从主build.gradle(在应用程序的根目录中)中删除这些行.

  ext {
      compileSdkVersion 17
      buildToolsVersion '18.1.0'
    }
    dependencies {
    }
Run Code Online (Sandbox Code Playgroud)


Bil*_*ote 9

您最近是否升级到Android Studio 1.0?如果是这样,请在app/build.gradle中使用minifyEnabled替换runProguard.