gpt4 book ai didi

java - Gradle 构建错误 java.lang.IllegalArgumentException

转载 作者:行者123 更新时间:2023-12-03 05:51:35 25 4
gpt4 key购买 nike

当我想启动我的项目时,我遇到了成绩构建错误。它是这样的:

Error:Execution failed for task ':app:processDebugResources'.
> java.lang.IllegalArgumentException (no error message)

我复制粘贴了一些东西到这个项目中,之前导致了一些错误,所以可能是由于复制/粘贴而导致的错误......

这是我的 build.grade 文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

和另一个 build.gradle 文件:
    apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.leodr.upgradeadmin"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/gson-1.4.jar')
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

我希望你能帮助我,TY为你的帮助!

最佳答案

更新您的项目级别 build.grade :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

和你的模块级别 build.gradle :

更改这些行:
compileSdkVersion 26
buildToolsVersion "26.0.2"

到:
compileSdkVersion 27 //buildToolsVersion is not needed

和:
targetSdkVersion 26

到:
targetSdkVersion 27

和依赖行:
compile 'com.android.support:appcompat-v7:26.+'

到:
compile 'com.android.support:appcompat-v7:27.0.1'

现在同步您的项目,如果它提示您下载,只需单击错误中的链接即可下载。

关于java - Gradle 构建错误 java.lang.IllegalArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47463914/

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