首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >导致: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:找不到方法compileSdk()

导致: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:找不到方法compileSdk()
EN

Stack Overflow用户
提问于 2022-08-23 13:25:12
回答 1查看 2.3K关注 0票数 1

大家好,我在android中遇到了这个问题,这里是我安装的sdk:安装了我的sdk,除了那2

我遇到了这样的问题:

代码语言:javascript
运行
复制
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method compileSdk() for arguments [30] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
代码语言:javascript
运行
复制
Gradle sync failed: Could not find method compileSdk() for arguments [30] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
代码语言:javascript
运行
复制
Caused by: java.lang.IllegalStateException: compileSdkVersion is not specified.

我的build.gradle文件:

代码语言:javascript
运行
复制
android {
    compileSdk 30
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "Net.er.bate.accel"
            minSdk 19
        targetSdk 31
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
EN

回答 1

Stack Overflow用户

发布于 2022-08-23 14:05:37

您缺少了Version部分的compileSdkVersionminSdkVersiontargetSdkVersion变量。

尝试将您的build.gradle文件更新到以下内容,并查看它是否有效。

代码语言:javascript
运行
复制
android {
    compileSdkVersion 30
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "Net.er.bate.accel"
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73459594

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档