android - Dialogflow SDK 上的单个 dex 文件中无法容纳请求的类(#方法:156179 > 65536)
问题描述
我正在关注关于如何在 android 应用程序上实现对话框流的 2018 年教程。但是当我按照该教程进行操作时,我在放置依赖项时偶然发现了一个问题。
这就是我的 build.gradle 文件的样子
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.specialgift"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'ai.api:sdk:2.0.7@aar'
implementation 'ai.api:libai:1.6.12'
implementation 'com.google.cloud:google-cloud-dialogflow:0.67.0-alpha'
implementation 'io.grpc:grpc-okhttp:1.15.1'
}
我收到一条错误消息说
无法在单个 dex 文件中容纳请求的类(# 方法:156179 > 65536)
在寻找其他较新的教程后,我发现了来自 dialogflow-android github 页面的消息,我总结说 android sdk 自 2019 年 10 月(即创建教程之后)以来已被弃用。从 dialogflow 文档页面,我找不到任何 android sdk 文档。
SDK 是否已被弃用或有其他解决方案来解决此错误?
解决方案
该错误与弃用无关,它只是意味着您需要在您的应用程序中启用 Multidex。
推荐阅读
- sql - 考勤SQL查询
- xamarin.forms - Xamarin Forms AppShell - 子页面过早调用 OnAppearing
- java - 我无法通过 ViewPager 正确地将项目编号传递给片段
- android - React Native + Android 原生模块:HMRClient 不是注册的可调用模块
- vb.net - 数据网格视图仅在单元格中显示一个字母
- azure - 在管道中使用 Get Metadata 活动时,如何为 blob 存储中的任何文件/容器获取自定义元数据参数(键值)?
- android - 如何在 Flutter 中使用 chrome 自定义标签
- c# - Unity 3D 2019:x 位置不断变化
- javascript - Chartjs - destroy() 什么都不做
- javascript - 即使我添加 polyfill,获取对象也不支持属性或方法“条目”错误