【问题标题】:Cannot fit requested classes in a single dex file (# methods: 156179 > 65536) on Dialogflow SDKDialogflow SDK 上的单个 dex 文件中无法容纳请求的类(#方法:156179 > 65536)
【发布时间】:2023-03-27 05:15:01
【问题描述】:

我正在关注 2018 年关于如何在 android 应用上实现对话流的教程。但是当我按照该教程进行操作时,我在放置依赖项时偶然发现了一个问题。

这就是我的 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 是否已被弃用或有其他解决方案来解决此错误?

【问题讨论】:

    标签: android dialogflow-es


    【解决方案1】:

    该错误与弃用无关,它只是意味着您需要在您的应用中enable Multidex

    【讨论】:

    • 哇,我觉得很傻,因为我以前看过那个解决方案,但我认为我有不同的方法,因为我使用不同的依赖项......谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-09
    • 1970-01-01
    • 2020-02-03
    • 2018-06-23
    相关资源
    最近更新 更多