gpt4 book ai didi

java - 无法为 org.gradle.api.Project 类型的项目 ':app' 上的参数找到方法 buildTypes()

转载 作者:行者123 更新时间:2023-12-03 17:43:10 35 4
gpt4 key购买 nike

在我将 Eclipse 项目导入到 Android Studio 3.0.1 之后

现在这是我的项目的 build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.zombieshunter.gameoverstudios"
minSdkVersion 14
targetSdkVersion 27
versionCode 3
versionName "1.0"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
ndk {
moduleName "player_shared"
}
multiDexEnabled true

}

dexOptions {
javaMaxHeapSize "4g"
}
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
productFlavors {
prod {
buildConfigField 'String', 'URL', '"http://api.abcd.com"'
}
}


dependencies {
compile 'com.google.android.gms:play-services:12.0.1'
compile 'com.android.support:support-v13:27.1.1'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
}
}

这是根 build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
}

这是输出
Error:(27, 0) Could not find method buildTypes() for arguments [build_4fb364oy5uo8h1irwj22vkw4h$_run_closure2@601eabab] on project ':app' of type org.gradle.api.Project.
<a href="openFile:G:\my game of now\zombies\android studio\app\build.gradle">Open File</a>

最佳答案

我猜这个问题是因为buildTypes在错误的地方:

现在

apply plugin: 'com.android.application'

android {
...
}

buildTypes {
...

dependencies {
...
}

}

正确
apply plugin: 'com.android.application'

android {
...
buildTypes {
...
}
}

dependencies {
...
}

关于java - 无法为 org.gradle.api.Project 类型的项目 ':app' 上的参数找到方法 buildTypes(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50720145/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com