0

在应用程序中使用 hilt 并在 Jelly Bean 设备上发生以下崩溃。

08-30 17:16:11.143 13630-13630/com.company.app E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.VerifyError: okhttp3/internal/platform/Android10Platform
    at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
    at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
    at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
    at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
    at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202)
    at retrofit2.Retrofit$Builder.build(Retrofit.java:614)com.company.app.DaggerMyApplication_HiltComponents_ApplicationC.i(:69)

这是我在 gradle 中使用的所有依赖项。

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
    implementation 'com.google.android.material:material:1.2.0'
    implementation 'com.google.android.gms:play-services-ads-lite:19.3.0'

    implementation 'com.squareup.retrofit2:retrofit:2.8.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.8.1'

    //implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
    //implementation "androidx.core:core-ktx:1.3.1"
    implementation "androidx.fragment:fragment-ktx:1.2.5"

    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha07'

    implementation 'androidx.paging:paging-runtime-ktx:2.1.2'

    //implementation 'com.airbnb.android:lottie:3.0.7'
    implementation 'com.google.firebase:firebase-messaging:20.2.4'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'

    implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02"
    implementation 'com.google.dagger:hilt-android:2.28-alpha'
    kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
    kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
}
4

1 回答 1

1

不是刀柄问题改造使它崩溃。经过改造文件发现我正在使用的版本,不支持 api level 18。我不得不降级改造版本并修复崩溃。

implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
于 2020-08-31T12:58:22.793 回答