提问者:小点点

格拉德尔 构建Android


这不会构建。我不知道为什么我不能构建APK。在Android Studio上。有谁知道问题可能是什么,我在底部发布了错误。

android { compileSdk 31

defaultConfig {
    applicationId "com.example.app"
    minSdk 21
    targetSdk 31
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        applicationIdSuffix ".novemberrelease"
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
     beta {
        minifyEnabled false
        applicationIdSuffix ".beta"
         debuggable false
     }
}
productFlavors {
    demo {
        applicationIdSuffix ".demo"
    }
    full {
        applicationIdSuffix ".full"
    }
    free {
        applicationIdSuffix ".free"
    }
    pro {
        applicationIdSuffix ".pro"
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}


dependencies {

    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}

}


I have tried many variations of removing stuff and I just cant seem to figure it out. It also shows 

评估项目“:app”时出现问题。

在org.gradle.api.Project类型的“app”上找不到参数[build _ eh 32 q 9 lb 75 jdu 53 u 2 yvsag 6 c 8 $ _ run _ closure 1 @ 10 b1d 7 b 9]的方法android()。

  • 尝试:

使用- info或- debug选项运行以获得更多日志输出。使用- scan运行以获得全面的见解。

    null



































I just wanted to run/ build a APK. 

共1个答案

匿名用户

在adroid关闭之前添加此项

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}