在android Studio中,当我尝试构建项目时,我遇到了问题'无法设置未知属性' s' for source set main of com.android.build.gradle.internal.api.DefaultAndroidSourceSet。' 未知属性是app的build.gradle文件中的java.srcDir s = [app / src / main / java]。该文件的代码如下:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.admin.myprofile"
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'
}
}
sourceSets {
main {
java.srcDir s =['app/src/main/java']
} }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.41"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
}
答案 0 :(得分:2)
java.srcDir s =['app/src/main/java']
=> java.srcDirs =['app/src/main/java']