2017-05-17 5 views
0

私はmultidexの使用に問題があります。 applicaitonスタートがエラーを持っている場合には、唯一のASUS Zenphone MAX with 5.1 Androidに、仕事の罰金ですが、私はAppModuleDagger2 DI)を作成するときにAsusのMultidex 5.1

05-17 16:37:11.624 11229-11229/ru.techmas.neeosocial E/AndroidRuntime: FATAL EXCEPTION: main Process: ru.techmas.neeosocial, PID: 11229 java.lang.NoClassDefFoundError: Failed resolution of: Lrx/subjects/PublishSubject; at ru.techmas.neeosocial.utils.RxPush.(RxPush.java:18) at ru.techmas.neeosocial.dagger.modules.AppModule.(AppModule.java:46) at ru.techmas.neeosocial.App.setupDagger2(App.java:58) at ru.techmas.neeosocial.App.onCreate(App.java:34) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4559) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5289) 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:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.ClassNotFoundException: Didn't find class "rx.subjects.PublishSubject" on path: DexPathList[[zip file "/data/app/ru.techmas.neeosocial-1/base.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_dependencies_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_0_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_1_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_2_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_3_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_4_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_5_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_6_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_7_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_8_apk.apk", zip file "/data/app/ru.techmas.neeosocial-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ru.techmas.neeosocial-1/lib/arm64, /vendor/lib64, /system/lib64]] 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 ru.techmas.neeosocial.utils.RxPush.(RxPush.java:18)  at ru.techmas.neeosocial.dagger.modules.AppModule.(AppModule.java:46)  at ru.techmas.neeosocial.App.setupDagger2(App.java:58)  at ru.techmas.neeosocial.App.onCreate(App.java:34)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4559)  at android.app.ActivityThread.access$1500(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5289)  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:899)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)  Suppressed: java.lang.ClassNotFoundException: rx.subjects.PublishSubject 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) ... 16 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available 05-17 16:42:11.945 11229-11229/ru.techmas.neeosocial I/Process: Sending signal. PID: 11229 SIG: 9 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

それが発生し、ラインrxPush(restApiを作成するときにrestApiとのスワップは、それが発生した場合。

AppModule:

public AppModule(App app) { 
    this.app = app; 
    preferenceHelper = new PreferenceHelper(PreferenceManager.getDefaultSharedPreferences(app)); 
    dataChecker = new DataChecker(); 
    geoHelper = new GeoHelper(); 
    animationHelper = new AnimationHelper(app); 
    user = new UserDTO(); 
    friendPerson = new PersonDTO(); 
    rxPush = new RxPush(); 
    restApi = new RestApi(preferenceHelper, app); 
} 

のGradle:

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
} 

apply plugin: 'com.neenbedankt.android-apt' 
apply plugin: 'me.tatarka.retrolambda' 
apply plugin: 'realm-android' 


def getStore = { -> 
    def result = project.hasProperty('storeFile') ? storeFile : "null" 
    return result 
} 

def getStorePassword = { -> 
    def result = project.hasProperty('storePassword') ? storePassword : "" 
    return result 
} 

def getKeyAlias = { -> 
    def result = project.hasProperty('keyAlias') ? keyAlias : "" 
    return result 
} 

def getKeyPassword = { -> 
    def result = project.hasProperty('keyPassword') ? keyPassword : "" 
    return result 
} 


android { 

    applicationVariants.all { variant -> 
     variant.outputs.each { output -> 
      output.outputFile = new File(
        output.outputFile.parent, 
        output.outputFile.name.replace("app", "${variant.applicationId}-${variant.versionName}")) 
     } 
    } 

    compileSdkVersion = 25 
    buildToolsVersion = "25.0.2" 
    defaultConfig { 
     applicationId "ru.techmas.neeosocial" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 7 
     versionName "0.5.3" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    signingConfigs { 
     release { 
      storeFile file(getStore()) 
      storePassword getStorePassword() 
      keyAlias getKeyAlias() 
      keyPassword getKeyPassword() 
     } 
    } 
    buildTypes { 
     release { 
      signingConfig signingConfigs.release 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    compileOptions { 
     targetCompatibility 1.8 
     sourceCompatibility 1.8 
    } 
} 

dependencies { 
    compile 'com.android.support:multidex:1.0.0' 
    compile project(':webrtc') 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.arello-mobile:moxy:1.4.5' 
    compile 'com.arello-mobile:moxy-app-compat:1.4.5' 
    compile 'com.arello-mobile:moxy-android:1.4.5' 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
    compile 'com.squareup.okhttp3:okhttp:3.5.0' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.5.0' 
    compile 'io.reactivex:rxjava:1.1.5' 
    compile 'io.reactivex:rxandroid:1.0.1' 
    compile 'com.android.support:design:25.1.0' 
    compile 'com.android.support:recyclerview-v7:25.1.0' 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile 'com.android.support:support-v4:25.1.0' 
    compile 'com.android.support:cardview-v7:25.1.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' 
    compile 'de.hdodenhof:circleimageview:1.3.0' 
    compile 'com.google.dagger:dagger:2.5' 
    compile 'org.greenrobot:eventbus:3.0.0' 
    compile 'com.github.christophesmet:android_maskable_layout:d51245736a' 
    compile 'jp.wasabeef:blurry:2.1.0' 
    compile 'com.google.android.gms:play-services-maps:9.0.1' 
    compile 'com.google.android.gms:play-services-location:9.0.1' 
    compile 'ru.tinkoff.decoro:decoro:1.3.2' 
    compile 'com.google.firebase:firebase-messaging:9.0.1' 
    testCompile 'junit:junit:4.12' 
    apt 'com.google.dagger:dagger-compiler:2.5' 
    provided 'com.arello-mobile:moxy-compiler:1.4.5' 
    provided 'javax.annotation:jsr250-api:1.0' 
} 

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

アプリケーション(WebRtcAppがMultiDexApplicationを拡張拡張):他のモデル(4,5,6アンドロイド)で

public class App extends WebRtcApp { 

    private static AppComponent appComponent; 


    //@formatter:off 
    @Inject DataChecker dataChecker; 
    //@formatter:on 

    @Override 
    public void onCreate() { 
     super.onCreate(); 
     setupDagger2(); 
     setupDataChecker(); 
     setupFabric(); 
     setupRealm(); 
    } 

    private void setupRealm() { 
     Realm.init(this); 
     RealmConfiguration config = new RealmConfiguration.Builder() 
       .schemaVersion(Const.RealmScheme.VERSION) // Must be bumped when the schema changes 
       .deleteRealmIfMigrationNeeded() 
       .build(); 
     Realm.setDefaultConfiguration(config); 
    } 

    private void setupDataChecker() { 
     dataChecker.setContext(this); 
    } 

    private void setupFabric() { 
     Fabric.with(this, new Crashlytics()); 
    } 

    private void setupDagger2() { 
     appComponent = DaggerAppComponent.builder() 
       .appModule(new AppModule(this)) 
       .build(); 
     appComponent.inject(this); 
    } 

    public static AppComponent getAppComponent() { 
     return appComponent; 
    } 

それがうまく機能しています。 クリーンで再構築し、再起動してキャッシュを無効にしないでください

答えて

0

インスタント実行で問題が発生しました。私はそれを無効にし、すべての良い仕事。