java.lang.NoClassDefFoundError:okhttp3.internal.Util [英] java.lang.NoClassDefFoundError: okhttp3.internal.Util

查看:187
本文介绍了java.lang.NoClassDefFoundError:okhttp3.internal.Util的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[在此处输入图片描述] [1]

[enter image description here][1]

我的程序可以运行Android 5.1手机,但是该手机将无法运行Android 4.3,并且将超出错误的范围

My program can run Android 5.1 phone , but the phone will not be able to run Android 4.3 , and will run out of the bottom of the error

> E/AndroidRuntime: FATAL EXCEPTION: EventThread
>java.lang.NoClassDefFoundError: okhttp3.internal.Util
>at okhttp3.OkHttpClient.<clinit>(OkHttpClient.java:65)
>at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.java:381)>
at>io.socket.engineio.client.transports.WebSocket.doOpen(WebSocket.java:51)
    >at io.socket.engineio.client.Transport$1.run(Transport.java:75)
    >at io.socket.thread.EventThread.exec(EventThread.java:50)
    >at io.socket.engineio.client.Transport.open(Transport.java:70)
    >at io.socket.engineio.client.Socket.probe(Socket.java:458)
    >at io.socket.engineio.client.Socket.onOpen(Socket.java:471)
    >at io.socket.engineio.client.Socket.onHandshake(Socket.java:512)
    >at io.socket.engineio.client.Socket.onPacket(Socket.java:485)
    >at io.socket.engineio.client.Socket.access$900(Socket.java:30)
    >at io.socket.engineio.client.Socket$5.call(Socket.java:299)
    >at io.socket.emitter.Emitter.emit(Emitter.java:117)
    >at io.socket.engineio.client.Transport.onPacket(Transport.java:127)
    >at>io.socket.engineio.client.transports.Polling.access$700(Polling.java:17)
    >at>io.socket.engineio.client.transports.Polling$2.call(Polling.java:124)
    >at io.socket.engineio.parser.Parser.decodePayload(Parser.java:251)
>at>.socket.engineio.client.transports.Polling._onData(Polling.java:134)
    >at> io.socket.engineio.client.transports.Polling.onData(Polling.java:106)
    >at>io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:113)
    >at io.socket.thread.EventThread$2.run(EventThread.java:75)
    >at>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    >at >java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    >at java.lang.Thread.run(Thread.java:841)



my build.gradle


compileSdkVersion 24
    buildToolsVersion "24.0.0"
    // For customization of Volley to build.
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "my---"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    repositories {
        flatDir {
            dirs '../Libraries/aar'
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
     compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:24.1.1'
        compile 'com.android.support:design:24.1.1'
        compile 'com.android.support:cardview-v7:24.1.1'
        compile 'com.android.support:customtabs:24.1.1'
        compile 'com.android.support:preference-v7:24.1.1'
        compile 'com.android.support:preference-v14:24.1.1'
        compile 'com.android.support:recyclerview-v7:24.1.1'
        compile 'com.android.support:support-v4:24.1.1'
        compile 'com.android.support:support-annotations:24.1.1'
        compile 'com.nineoldandroids:library:2.4.0'
        compile 'com.malinskiy:materialicons:1.0.1'
        compile 'com.google.zxing:core:3.2.1'
        compile 'com.google.guava:guava:19.0'
        compile 'com.android.volley:volley:1.0.0'
        compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
        compile 'com.squareup.okhttp3:okhttp:3.3.1'
        compile 'com.roughike:bottom-bar:1.4.0.1'
        compile 'com.malinskiy:superrecyclerview:1.1.4'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'com.dmitrymalkovich.android:material-design-dimens:1.2'
        compile 'com.eowise:recyclerview-stickyheaders:0.5.0@aar'
        compile('com.vincentbrison.openlibraries.android:dualcache:2.2.2@jar') {
            transitive = true
        }
        compile(name: 'com.leenanxi.android.open.qrcode', ext: 'aar')
        testCompile 'junit:junit:4.12'
        compile 'com.google.code.gson:gson:2.7'
        compile('io.socket:socket.io-client:0.7.0') {
            exclude group: 'org.json', module: 'json'
        }
        compile project(':imui')
        androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
        androidTestCompile 'com.android.support.test:runner:0.5'
        androidTestCompile 'com.android.support:support-annotations:24.1.1'
        compile files('libs/pushservice-5.1.0.48.jar')

我的构建

推荐答案

您已启用"multiDexEnabled true",并且很可能没有在Application类中安装它.

You have enabled "multiDexEnabled true" and most probably you are not installing it in Application class.

这是您应该做的

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true       //You have already did this 
         }
}


dependencies {
    compile 'com.android.support:multidex:1.0.1'   // add this in  dependencies
}

最后扩展应用程序

public class YouApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}

这是一个很好的指南 https://developer.android.com/studio/build/multidex.html

这篇关于java.lang.NoClassDefFoundError:okhttp3.internal.Util的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆