Android Studio 3.0未解决的参考:SupportedLanguages for AIConfiguration类在Dialogflow(api.ai)

我正在通过查询Dialogflow代理程序在Kotlin中构建一个chatbot Android应用程序。 我正在使用Dialogflow Android客户端github存储库自述文件和该存储库中提供的示例应用程序作为构建应用程序的基础。 如上所述, AIConfiguration.SupportedLanguages java代码AIConfiguration.SupportedLanguages工作:

 import ai.api.android.AIConfiguration; ..... private void initService(final LanguageConfig selectedLanguage) { final AIConfiguration.SupportedLanguages lang = AIConfiguration.SupportedLanguages.fromLanguageTag(selectedLanguage.getLanguageCode()); ..... 

你可以在这里find完整的用法。

当我在Kotlin中实现时:

 import ai.api.android.AIConfiguration .... private fun initService() { //final AIConfiguration.SupportedLanguages lang = AIConfiguration.SupportedLanguages.fromLanguageTag(selectedLanguage.getLanguageCode()); val config = AIConfiguration(CLIENT_ACCESS_TOKEN, AIConfiguration.SupportedLanguages.EnglishGB, AIConfiguration.RecognitionEngine.System) .... 

在Android 3.0中,我得到了ALConfiguration.SupportedLanguages的“ Unresolved reference:SupportedLanguages ”的AIConfiguration.SupportedLanguagesAIConfiguration.RecognitionEngine解决得很好。 为什么这个问题会发生? 我可以实施哪些解决方案/解决方案?

我的更高级别的build.gradle文件:

 apply plugin: 'com.android.feature' android { compileSdkVersion 27 baseFeature true defaultConfig { minSdkVersion 23 targetSdkVersion 27 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } buildToolsVersion '27.0.1' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { api 'com.android.support:appcompat-v7:27.0.0' api 'com.android.support:design:27.0.0' api 'com.android.support.constraint:constraint-layout:1.0.2' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'ai.api:sdk:2.0.7@aar' compile 'ai.api:libai:1.6.12' //compile project(':ailib') application project(':app') feature project(':chatbot') } 

我的模块build.gradle文件:

 apply plugin: 'com.android.feature' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 27 defaultConfig { minSdkVersion 23 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } buildToolsVersion '27.0.1' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" implementation project(':base') //add the google gson library compile 'com.google.code.gson:gson:2.8.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

一个解决方法,我发现正在工作是使用ai.api.AIConfiguration.SupportedLanguages是解决而不是ai.api.android.AIConfiguration.SupportedLanguages在Android Studio 3.0中不解决在问题中提到的kotlin。

但是,调用ai.api.android.AIConfiguration.SupportedLanguages在Java代码中工作得很好,在这种情况下,它在Android Studio 3.0中正确解析。 由于ai.api.android.AIConfiguration实现ai.api.AIConfiguration ,为什么这个问题正在出现令人费解!