小编Git*_*ita的帖子

Android Studio:找不到“:app”的变体

我正在做我的最终项目,我想用 android studio 做项目,我对 android studio 真的很陌生,我遇到了一个错误,说没有找到“:app”的变体, 我尝试更改或下载另一个版本SDK,但它没有解决任何问题

这是 build.gradle 代码:

buildscript {

   repositories {

   google()  // Google's Maven repository

   mavenCentral()  // Maven Central repository

  }

   dependencies {
   
   classpath 'com.android.tools.build:gradle:4.2.1'

   classpath 'com.google.gms:google-services:4.3.15'

  }

}


allprojects {

   repositories {

   google()  // Google's Maven repository

   mavenCentral()  // Maven Central repository

 }

}
Run Code Online (Sandbox Code Playgroud)

这是 app/build.gradle 的代码:

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    namespace 'com.example.chatapp'
    compileSdk 33

    defaultConfig {
        applicationId "com.example.chatapp"
        minSdk 24
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner …
Run Code Online (Sandbox Code Playgroud)

android variant gradle android-studio android-gradle-plugin

5
推荐指数
1
解决办法
4259
查看次数