该项目可以使用一个版本的摇篮的不包含所述方法'compileSdkVersion()'可以使用、该项目、摇篮、所述

2023-09-09 21:14:09 作者:腹黑甜心,你别逃

我想最初运行基于Eclipse ADT做了一个项目时面临这个问题。

 错误:(17,0)摇篮DSL方法未找到:'compileSdkVersion()可能的原因:其中; UL><李>该项目的TaxiAndroidOpen主'可以使用一个版本的摇篮不包含的方法。< A HREF =open.wrapper.file>打开包装摇篮和文件LT; / A>< /李><李>在构建文件可能丢失一个摇篮插件。< A HREF =apply.gradle.plugin>应用摇篮插件< / A>< /李> 

我已经转换为这个工作室的Andr​​oid系统的gradle

但我不能运行,也没有编译,因为这个错误吧,这里是产生gradle这个:

  //顶级构建文件,您可以添加常用的配置选项,所有分项目/模块。buildscript {库{    jcenter()}依赖{    类路径'com.android.tools.build:gradle:1.0.0   }}allprojects {库{    jcenter()   }}转{compileSdkVersion 17buildToolsVersion '18 .1.0}依赖{} 

我已经发现了一些其他职位在这里所以,用类似的错误,但没有人有这种特殊的。

我使用的Andr​​oid 1.0.2工作室,86。

任何人都可以阐明这一些轻?

在此先感谢!

奇点智库 未来10年,是地产行业的大洗牌时代 你家房企会被洗掉吗

修改

更新的build.gradle:

 应用插件:'com.android.application安卓{compileSdkVersion 17buildToolsVersion21.1.2defaultConfig {    的applicationIDcom.opentaxi.android    9的minSdkVersion    targetSdkVersion 19}buildTypes {    发布 {        minifyEnabled假        proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard的-rules.txt    }}}依赖{编制项目(':comtaxibulgariamap_mapsforge_044201406271417533')编译文件(库/ littlefluffylocationlibrary_r15.jar')} 

解决方案

您的应用程序模块的build.gradle文件应该是这样的。

 应用插件:'com.android.application安卓{   compileSdkVersion 17   buildToolsVersion21.1.2defaultConfig {     的applicationIDcom.opentaxi.android     9的minSdkVersion     targetSdkVersion 19  }    buildTypes {        发布 {            minifyEnabled假            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro        }    }}依赖{    编制项目(':comtaxibulgariamap_mapsforge_044201406271417533')    编译文件树(包括:['的* .jar'],DIR:库)} 

和删除您主要的build.gradle这些行(在应用程序的根),如果存在的话,你公布。

 转{      compileSdkVersion 17      buildToolsVersion '18 .1.0    }    依赖{    } 

I'm facing this issue when trying to run a project originally made on 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>

I already converted this to Android Studio gradle system.

But I cannot run it, nor compile it, because of this error, here's the gradle generated:

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

I've found some other posts here on SO, with similar errors, but no one has this specific one.

I'm using Android Studio 1.0.2, x86.

Anybody can shed some light on this?

Thanks in advance!

EDIT

Updated 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')
}

解决方案

Your application module's build.gradle file should look like this.

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

And remove these lines from your main build.gradle (in application's root) if it exists as you posted.

  ext {
      compileSdkVersion 17
      buildToolsVersion '18.1.0'
    }
    dependencies {
    }

 
精彩推荐