dev*_*v90 9 performance android facebook gradle android-layout
应用程序在所有操作系统上运行正常,但是当我添加facebook SDK时,它会在棒棒糖设备上给出以下错误消息.
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
Run Code Online (Sandbox Code Playgroud)
引起:java.lang.ClassNotFoundException:路径上没有找到类"retrofit2.Retrofit $ Builder":DexPathList [[zip file"/data/app/com.myapp.app-3/base.apk",zip文件
java.lang.NoClassDefFoundError:解析失败:Lretrofit2/Retrofit $ Builder; 引起:java.lang.ClassNotFoundException:路径上没有找到类"retrofit2.Retrofit $ Builder":DexPathList [[zip file"/data/app/com.myapp.app-3/base.apk",zip文件"/ data/app/com.myapp.app-3/split_lib_dependencies_apk.apk",
这是我的gradle文件.
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId 'com.myapp.app'
minSdkVersion 21
targetSdkVersion 23
versionCode 122
versionName "1.2.5"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp:okhttp:2.4.0'
force 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
force 'com.squareup.okio:okio:1.11.0'
force 'com.squareup.okhttp3:okhttp:3.6.0'
force 'com.squareup.retrofit2:retrofit:2.2.0'
force 'com.android.support:recyclerview-v7:25.0.0'
force 'com.android.support:support-v4:25.0.0'
force 'com.android.support:cardview-v7:25.0.0'
force 'com.android.support:appcompat-v7:25.0.0'
force 'com.android.support:design:25.0.0'
force 'com.android.support:support-annotations:25.0.0'
force 'com.google.android.gms:play-services-ads:9.0.1'
force 'com.google.android.gms:play-services-location:9.0.1'
force 'com.google.android.gms:play-services-auth-base:9.0.1'
force 'com.google.android.gms:play-services-base:9.0.1'
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
}
Run Code Online (Sandbox Code Playgroud)
请指导我这次坠机的原因是什么,以及为什么它只会撞上棒棒糖设备并在Marshmallow和Nougat上正常工作.
编辑
如果我不使用facebook sdk,一切似乎都很好,没有崩溃.也许Facebook sdk引起了这个问题,但我不知道为什么
您使用的库太多,因此您的方法已超过64k,因此您必须为项目启用Multidex
你的内心 build.gradle
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Run Code Online (Sandbox Code Playgroud)
并在 AndroidManifest.xml
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅此
| 归档时间: |
|
| 查看次数: |
1844 次 |
| 最近记录: |