错误:找不到符号类为android studio 3.0稳定的java类添加kotlin类

我使用android studio 3.0和一些旧的Java类转换Java到Kotlin。 之后Kotlin类不能在java类中导入! 在下面你可以看到我的等级和我的错误图片。

模块build.grade

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.google.gms:google-services:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

在应用程序级build.gradel通常我使用gradel代码和android 3.0我认为我们需要任何东西

 apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.idehnavazan.beautifierclient" minSdkVersion 14 targetSdkVersion 25 versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } dataBinding { enabled = true } } repositories { mavenCentral() jcenter() maven { url 'https://maven.google.com' } maven { url 'https://jitpack.io' } } dependencies { compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.github.rey5137:material:1.2.2' compile 'com.android.support:cardview-v7:25.3.1' } apply plugin: 'com.google.gms.google-services' 

在这里输入图像描述

要使用Kotlin文件,您需要将Kotlin添加到您的项目中。

项目/的build.gradle

 buildscript { ext.kotlinVersion = '1.1.51' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } 

项目/模块/的build.gradle

 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" } 

下一步是什么

由于您使用的支持库25.3.1和Android插件3.0.0,您的下一个问题可能是这样的: 样式属性'@android:attr / windowEnterAnimation'找不到 。