2017-10-13 3 views
2

Meine App funktionierte gut, aber aufgrund eines Problems mit meinem Betriebssystem Debian entschied ich mich, es neu zu installieren und entschied mich, Ubuntu-16.04 anstelle des letzten Debian zu installieren. Jetzt ist alles ok.Android: Fehlgeschlagene Auflösung von: Ldagger/internal/Vorbedingungen

Das Problem ist meine Android-Anwendung. Nach der Neuinstallation android-studio die stabile Version, kann ich meine Anwendung nicht mehr testen.

Warum? Da jedes Mal, wenn ich die Anwendung starte, habe ich diesen Fehler bekommen. Ich weiß nicht was es ist und nach ein paar Recherchen im Internet habe ich nichts bekommen. Hier ist der Stack-Trace

10-13 07:47:10.749 1631-1631/com.gre E/AndroidRuntime: FATAL EXCEPTION: main 
                 Process: com.gre, PID: 1631 
                 java.lang.NoClassDefFoundError: Failed resolution of: Ldagger/internal/Preconditions; 
                  at com.gre.di.components.DaggerApplicationComponent$Builder.applicationModule(DaggerApplicationComponent.java:209) 
                  at com.gre.GreApplication.onCreate(GreApplication.java:47) 
                  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012) 
                  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4593) 
                  at android.app.ActivityThread.access$1600(ActivityThread.java:154) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:135) 
                  at android.app.ActivityThread.main(ActivityThread.java:5294) 
                  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:904) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) 
                 Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.internal.Preconditions" on path: DexPathList[[zip file "/data/app/com.gre-1/base.apk", zip file "/data/app/com.gre-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.gre-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.gre-1/lib/arm, /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.gre.di.components.DaggerApplicationComponent$Builder.applicationModule(DaggerApplicationComponent.java:209)  
                  at com.gre.GreApplication.onCreate(GreApplication.java:47)  
                  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)  
                  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4593)  
                  at android.app.ActivityThread.access$1600(ActivityThread.java:154)  
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)  
                  at android.os.Handler.dispatchMessage(Handler.java:102)  
                  at android.os.Looper.loop(Looper.java:135)  
                  at android.app.ActivityThread.main(ActivityThread.java:5294)  
                  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:904)  
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)  
                 Suppressed: java.lang.ClassNotFoundException: dagger.internal.Preconditions 
                  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) 
                   ... 14 more 
                 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available 

Wie es lösen bitte ??

Hier ist meine build.gradle Datei

apply plugin: 'com.android.application' 
    apply plugin: 'realm-android' 
    // apply plugin: 'com.neenbedankt.android-apt' 

    android { 
     compileSdkVersion 25 
     buildToolsVersion '25.0.2' // '23.0.2' 

    defaultConfig { 
     applicationId "com.gre" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 

    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 

     /*debug { 
      applicationIdSuffix ".debug" 
     }*/ 

     /** 
     * The 'initWith' property allows you to copy configurations from other build types, 
     * so you don't have to configure one from the beginning. You can then configure 
     * just the settings you want to change. The following line initializes 
     * 'jnidebug' using the debug build type, and changes only the 
     * applicationIdSuffix and versionNameSuffix settings. 
     */ 

     jnidebug { 

      // This copies the debuggable attribute and debug signing configurations. 
      initWith debug 

      applicationIdSuffix ".jnidebug" 
      jniDebuggable true 
     } 
    } 
    dexOptions { 
     // javaMaxHeapSize "2048M" 
     javaMaxHeapSize "4g" 
    } 
    configurations.all { 
     // all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'configurations.all { 
     // OkHttp 3.5.0+ includes the websockets API, so we need this to prevent a conflict 
     exclude module: 'okhttp-ws' 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile('io.socket:socket.io-client:0.8.1') { 
     exclude group: 'org.json', module: 'json' 
    } 

    /*compile 'com.google.android.gms:play-services-auth:10.0.1' 
    compile 'com.google.android.gms:play-services-maps:10.0.1' 
    compile 'com.google.android.gms:play-services-appindexing:10.0.1'*/ 

    // compile 'com.android.support.constraint:constraint-layout:1.0.2' 

    // Android 
    // Glide 

    // Facebook Stetho 
    // OkHttp 
    // SquareUp 
    // Rx 
    // Dragger 
    // Realm 

    // RippleButton 
    compile 'com.balysv:material-ripple:1.0.2' 
    compile 'com.android.support:appcompat-v7:' 
    compile "com.android.support:cardview-v7:${buildTools}" 
    compile "com.android.support:recyclerview-v7:${buildTools}" 
    compile "com.android.support:design:${buildTools}" 
    compile "com.android.support:support-v13:${buildTools}" 
    compile "com.android.support:support-v4:${buildTools}" 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.github.bumptech.glide:glide:4.0.0-RC0' 
    compile 'com.github.florent37:materialtextfield:1.0.7' 
    compile 'uk.co.chrisjenx:calligraphy:2.2.0' 
    compile 'com.splitwise:tokenautocomplete:[email protected]' 
    compile 'com.github.Plumillon:ChipView:1.2.0' 
    compile 'com.github.clans:fab:1.6.4' 
    compile 'org.greenrobot:eventbus:3.0.0' 
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' 
    compile 'com.google.android.gms:play-services:10.2.6' 
    compile 'com.google.android.gms:play-services-location:10.2.6' 
    compile 'com.google.android.gms:play-services-maps:10.2.6' 
    compile 'com.google.firebase:firebase-core:9.2.0' 
    compile 'com.google.firebase:firebase-messaging:9.2.0' 
    compile 'com.bignerdranch.android:recyclerview-multiselect:+' 
    compile 'com.facebook.stetho:stetho:1.5.0' 
    compile 'com.uphyca:stetho_realm:2.0.0' 
    compile 'com.lapism:searchview:4.0' 
    compile 'com.miguelcatalan:materialsearchview:1.4.0' 
    compile 'com.github.arimorty:floatingsearchview:2.1.1' 
    compile 'me.philio:pinentryview:1.0.6' 
    compile 'com.alimuzaffar.lib:pinentryedittext:1.3.1' 
    compile 'com.google.code.gson:gson:2.6.2' 
    compile 'com.github.pchmn:MaterialChipsInput:1.0.8' 


    /*----- Retrofit 2 */ 
    compile 'com.squareup.okhttp3:okhttp:3.4.1' 
    compile 'com.squareup.okhttp3:okhttp-ws:3.4.1' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
    compile 'io.reactivex.rxjava2:rxjava:2.0.2' 
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' 
    compile 'com.google.dagger:dagger:2.11' 
    compile 'com.google.dagger:dagger-android:2.11' 
    compile 'javax.inject:javax.inject:1' 
    compile 'io.realm:android-adapters:2.0.0' 
    compile 'org.parceler:parceler-api:1.1.6' 
    compile 'com.jakewharton:butterknife:8.5.1' 
    compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+' 
    compile 'com.github.yalantis:ucrop:2.2.1-native' 
    compile 'jp.wasabeef:picasso-transformations:2.1.2' 
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' 
    compile 'com.github.dmytrodanylyk:android-morphing-button:98a4986e56' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    annotationProcessor 'com.google.dagger:dagger-android-processor:2.11' 
    annotationProcessor 'com.google.dagger:dagger-compiler:2.11' 
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0' 
    annotationProcessor 'org.parceler:parceler:1.1.6' 
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' 
    provided 'javax.annotation:jsr250-api:1.0' 
    compile 'com.mikhaellopez:circularimageview:3.0.2'   // circle image view 
} 


apply plugin: 'com.google.gms.google-services' 
+0

versuchen, ** 'clear-Rebuild-run' ** Ihr Projekt –

+0

Entschuldigung nichts. Gleicher Fehler –

+0

Bezogen auf https://github.com/google/dagger/issues/403 –

Antwort

0

ich das gleiche Problem konfrontiert und verbrachte 2 - 3 Stunden über sie und ich bin in der Lage zu finden, dass dieses Problem durch dex Grenze verursacht wird. In Ihrer app.gradle Datei bitte folgende Änderungen vornehmen:

defaultConfig { 
    multiDexEnabled true 
} 

Und innerhalb Abhängigkeiten Abschnitt hinzufügen

compile 'com.android.support:multidex:1.0.2' 

und das letzte, was Sie todo benötigen,

public class YourApplication extends MultiDexApplication { 
... 
} 

Sie haben zu verwenden MultiDexApplication statt Anwendung Klasse. Ich hoffe, dass einige Entwickler diese Lösung nutzen.

0

In meinem Fall war ich die Aktualisierung der Gradle Version, also habe ich die folgenden Zeilen in den Abhängigkeiten:

compileOnly 'com.google.dagger:dagger:2.11' 
annotationProcessor 'com.google.dagger:dagger-compiler:2.11' 
testAnnotationProcessor "com.google.dagger:dagger-compiler:2.11" 

aber auf einem Tutorial bassed, fand ich diese Zeilen und das Problem war gelöst.

implementation 'com.google.dagger:dagger:2.11' 
implementation 'com.google.dagger:dagger-android-support:2.11' 
annotationProcessor 'com.google.dagger:dagger-compiler:2.11' 
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11' 
0

Sie haben Ihre multidex Bibliothek für das

hinzufügen, um dieses gradle in Ihre Abhängigkeit in

dependencies { 
compile 'com.android.support:multidex:1.0.1' 
} 

und ermöglichen multidex

android { 
    defaultConfig { 
    ... 
    minSdkVersion 21 
    targetSdkVersion 26 
    multiDexEnabled true // check it carefully 
} 
... 
} 

zu halten Jetzt müssen Sie eine erstellen MyApplication-Klasse und erweitern Sie sie auf Anwendung

public class MyApplication extends Application { 
    @Override 
    protected void Create() { 
    MultiDex.install(this); 
    } 
} 

und definieren Sie es in Ihrem Manifest wie

<application 
     android:name=".MyApplication" > 
    ... 
</application> 

Jetzt Ihr Projekt erstellen und versuchen zu laufen.Ich denke, jetzt wird Ihr Problem gelöst werden

Verwandte Themen