gpt4 book ai didi

android - 在路径 : DexPathList on Android Library 上找不到类

转载 作者:搜寻专家 更新时间:2023-11-01 08:35:17 25 4
gpt4 key购买 nike

我正在开发一个 Android 库来对我的应用程序中的一些工作进行模块化,我使用改造来使用一些网络 API。

当我在同一个 Android Studio 项目中的示例应用程序(编译库模块)中编译和使用它时,一切正常,但是当我使用 Artifact 中的库时,出现错误 Did't find class在路径上....

我的 gradle.build 文件包含这个

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.+"
testCompile "org.hamcrest:hamcrest-core:1.3"
testCompile "org.hamcrest:hamcrest-library:1.3"
testCompile 'org.robolectric:robolectric:3.0'
}

我已经尝试过 retrofit 和 retrofit2,但我在实现该库的应用程序中仍然遇到同样的崩溃

Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.logging.HttpLoggingInterceptor" on path: DexPathList[[dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-support-annotations-23.3.0_471cb7629dd1bd2eaf19897f0bfa2e292d59a1a2-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-mx.segundamano.android-payments-library-0.1-SNAPSHOT_afd67b66a26310987e26f412f53082c415795025-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-internal_impl-23.3.0_ffb5ab0b136af54fef26d794f3208310ca6ef941-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.3.0_2834a08897c09d9f4cf6a603048125bd86044324-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-com.android.support-support-v4-23.3.0_0fe06b17a4b2ae866e5066f3ea5bc8d596bd609e-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_9e5a739896463403b4d643ff254bf74dcc98371f-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.3.0_eba794855dfef17238864c6651afded84f82cf47-classes.dex", dex file "/data/data/mx.segundamano.paymentsdemo/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.3.0_41e987bda5b0c3ecdbb65ba4dfa7c24496152077-classes.dex"],nativeLibraryDirectories=[/data/app/mx.segundamano.paymentsdemo-1/lib/arm64, /vendor/lib64, /system/lib64]]

05-11 11:40:03.737 4279 4279 E AndroidRuntime: 在 dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.j

最佳答案

我认为这是一个简单的 android studio 问题,以正确的顺序重新排列导入以防万一,然后清理并构建您的项目。

这解决了我的问题

关于android - 在路径 : DexPathList on Android Library 上找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37169328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com