【问题标题】:NoClassDefFoundError: Failed resolution of: Lokhttp3/logging/HttpLoggingInterceptor;NoClassDefFoundError:解析失败:Lokhttp3/logging/HttpLoggingInterceptor;
【发布时间】:2020-11-05 11:01:19
【问题描述】:

我有一个 aar 库项目,我在一个示例项目中使用它。我将相关库添加到 Maven 本地存储库。当我检查 Pom 文件时,我可以看到它是 Okhttp3 / logging / HttpLoggingInterceptor 依赖项。但我面临以下屏幕拍摄错误。有什么建议吗?

我的父应用 gradle 文件看起来像上面的代码

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.deneme"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.6'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    implementation 'com.mylibrary:feature:1.0.15@aar'
    implementation 'com.android.support:multidex:1.0.3'

}

【问题讨论】:

    标签: android maven android-library


    【解决方案1】:

    我的问题是,当 pom 文件生成时它生成不正确,我实际上是在错误的 sub-mobule 上遇到了问题。在我修复了我的 pom 设置后,我的问题就解决了。

    【讨论】:

      猜你喜欢
      • 2017-01-25
      • 2018-11-04
      • 2020-04-10
      • 2019-01-23
      • 1970-01-01
      • 2017-04-12
      • 2020-10-31
      • 1970-01-01
      • 2022-07-08
      相关资源
      最近更新 更多