2016-08-10 3 views
0

[enter image description here] [1]java.lang.NoClassDefFoundError: okhttp3.internal.Util

Mein Programm kann Android 5.1 Telefon laufen, aber das Telefon nicht in der Lage sein Android laufen 4.3 und läuft aus dem Boden des Fehlers

> 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:[email protected]' 
 
     compile('com.vincentbrison.openlibraries.android:dualcache:[email protected]') { 
 
      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')

mein build

+1

Ihre gradle anzeigen. –

+0

Ich füge die Gradle hinzu – Liup

+0

Bitte sehen Sie meine Antwort und fragen Sie, wenn Sie irgendwelche Zweifel haben. –

Antwort

2

Sie aktiviert haben "multiDexEnabled true" und mos Wahrscheinlich installieren Sie es nicht in der Anwendungsklasse.

Dies ist, wie Sie

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 
} 

tun sollten, und schließlich die Anwendung erweitern

public class YouApplication extends Application { 

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

} 

Und das ist ein guter Leitfaden https://developer.android.com/studio/build/multidex.html

+1

Die perfekte Lösung für mein Problem – Liup

+0

Ich bin froh, dass es Ihnen geholfen hat :) –

Verwandte Themen