Gradle 构建突然失败,提示“无法获取未知 属性 'testInstrum'...”
Gradle build suddenly fails saying 'Could not get unknown property 'testInstrum'...'
昨天我将一个应用程序推送到 PLayStore 进行发布...今天早上我尝试构建我的项目,突然 Gradle 构建失败说:
Could not get unknown property 'testInstrum' for DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=26, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=2, versionName=1.0, applicationId=com.foodhat.app, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig.
这是我的 Gradle 文件的一些事实:
compileSdkVersion 28
defaultConfig {
applicationId "com.foodhat.app"
minSdkVersion 26
targetSdkVersion 28
versionCode 2
versionName "1.0"
testInstrum
entationRunner "android.support.test.runner.AndroidJUnitRunner"
}
这里的问题是什么以及如何解决?
删除testInstrum
后的多余行:
compileSdkVersion 28
defaultConfig {
applicationId "com.foodhat.app"
minSdkVersion 26
targetSdkVersion 28
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
您在 testInstrum 之后添加了一个新行(可能是偶然的)并且它根据语法将 testIntrum 视为 属性 名称,这就是它给出错误的原因。
昨天我将一个应用程序推送到 PLayStore 进行发布...今天早上我尝试构建我的项目,突然 Gradle 构建失败说:
Could not get unknown property 'testInstrum' for DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=26, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=2, versionName=1.0, applicationId=com.foodhat.app, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig.
这是我的 Gradle 文件的一些事实:
compileSdkVersion 28
defaultConfig {
applicationId "com.foodhat.app"
minSdkVersion 26
targetSdkVersion 28
versionCode 2
versionName "1.0"
testInstrum
entationRunner "android.support.test.runner.AndroidJUnitRunner"
}
这里的问题是什么以及如何解决?
删除testInstrum
后的多余行:
compileSdkVersion 28
defaultConfig {
applicationId "com.foodhat.app"
minSdkVersion 26
targetSdkVersion 28
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
您在 testInstrum 之后添加了一个新行(可能是偶然的)并且它根据语法将 testIntrum 视为 属性 名称,这就是它给出错误的原因。