导入kotlinx.android.synthetic。<xml_name>显示“包无法导入”?

我已经分别在应用程序级build.gradle和project level build.gradle中添加了kotlin插件和扩展,仍然显示“package can not be imported”消息。以下是两个build.gradle文件的代码

1-build.gradle(应用程序模块) –

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 buildToolsVersion "26.0.0" defaultConfig { applicationId "com.example.paruld.learning_kotlin_project" 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(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile 'com.android.support:appcompat-v7:26.+' compile 'com.android.support.constraint:constraint-layout:1.0.2' } 

2-build.gradle(项目级别)

  buildscript { ext.kotlin_version = '1.1.3-2' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android- extensions:$kotlin_version" } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

我不明白为什么不能导入package.plz答案。