任何人都可以帮我解决这个问题,我的应用程序是启用了multidex的,我在android版本5和5以下问题我的应用程序崩溃了,因为找不到classnot,因为该类仍然存在。
我的Gradle文件是 -
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
repositories {
maven {
url 'http://repo.brightcove.com/releases'
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.weone.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 31
versionName "1.2.2"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file('/home/user/AndroidStudioProjects/WeOneWithExoPlayer/weone-android/certificate/WeOne.jks')
storePassword 'WeOneKey'
keyAlias 'weone'
keyPassword 'WeOneKey'
}
debug {
storeFile file('/home/user/.android/debug.keystore')
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
debug {
// signingConfig signingConfigs.debug
}
release {
minifyEnabled false
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
// multiDexKeepFile file 'multidex-config.txt'
}
}
/* afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
// optional
// dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
}
}*/
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.squareup.retrofit2:retrofit:2.2.0') {
exclude module: 'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.okhttp3:okhttp:3.+'
compile 'com.squareup.okhttp3:logging-interceptor:3.+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.naver.android.helloyako:imagecropview:1.0.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'joda-time:joda-time:2.9.2'
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:multidex-instrumentation:1.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.2.+'
compile 'com.google.guava:guava:19.0'
compile 'com.brightcove.player:exoplayer:4.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.facebook.network.connectionclass:connectionclass:1.0.1'
compile 'com.plattysoft.leonids:LeonidsLib:1.3.2'
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:design:25.+'
compile 'com.android.support:cardview-v7:25.+'
compile 'com.android.support:recyclerview-v7:25.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.github.jd-alexander:LikeButton:0.2.0'
compile 'com.turbomanage.basic-http-client:http-client-android:0.89'
compile 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
compile 'com.google.android.gms:play-services-ads:10.+'
compile 'com.google.android.gms:play-services-gcm:10.+'
compile 'com.google.android.gms:play-services:10.+'
compile 'com.hbb20:ccp:1.7.2'
compile 'com.google.android.gms:play-services-auth:10.+'
compile 'com.google.api-client:google-api-client-android:1.22.0'
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.googlecode.libphonenumber:libphonenumber:7.1.1'
compile 'com.android.support:animated-vector-drawable:25.+'
compile 'com.android.support:customtabs:25.+'
compile 'com.android.support:mediarouter-v7:25.+'
}
Project Gradle是 -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
repositories {
mavenCentral()
jcenter()
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url 'http://lorenzo.villani.me/android-cropimage/'
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
}
我的应用程序在5以下崩溃,我在过去2周内陷入困境。 到目前为止,Haven还没有解决方案。 :(
stacktrace ---------------------------------------------- -----
04-06 16:10:33.314 21020-21020/com.weone.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.weone.android, PID: 21020
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/api/client/extensions/android/http/AndroidHttp;
at com.weone.android.utilities.helpers.constants.Config.<clinit>(Config.java:26)
at com.weone.android.utilities.helpers.constants.Config.setAppModeConfig(Config.java:0)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.initThings(ApplicationProperties.java:59)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.access$000(ApplicationProperties.java:29)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties$1.run(ApplicationProperties.java:44)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.onCreate(ApplicationProperties.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
at android.app.ActivityThread.access$1500(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.api.client.extensions.android.http.AndroidHttp" on path: DexPathList[[zip file "/data/app/com.weone.android-1/base.apk", zip file "/data/app/com.weone.android-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.weone.android.utilities.helpers.constants.Config.<clinit>(Config.java:26)
at com.weone.android.utilities.helpers.constants.Config.setAppModeConfig(Config.java:0)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.initThings(ApplicationProperties.java:59)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.access$000(ApplicationProperties.java:29)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties$1.run(ApplicationProperties.java:44)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.onCreate(ApplicationProperties.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
at android.app.ActivityThread.access$1500(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Suppressed: java.lang.ClassNotFoundException: com.google.api.client.extensions.android.http.AndroidHttp
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available