Android 应用无法在 Api 19 打开

Android app Cannot Open at Api 19

我有 android 应用程序及其在 android marshmallow 及更高版本上完成的工作,我现在的问题是当我尝试在 android Kitkat 上使用 运行 应用程序时,应用程序崩溃,我收到此错误

    W/System.err: java.lang.TypeNotPresentException: Type Models.ResultModel not present
W/System.err:     at libcore.reflect.ParameterizedTypeImpl.getRawType(ParameterizedTypeImpl.java:63)
W/System.err:     at libcore.reflect.ParameterizedTypeImpl.getResolvedType(ParameterizedTypeImpl.java:72)
W/System.err:     at libcore.reflect.ListOfTypes.resolveTypes(ListOfTypes.java:70)
W/System.err:     at libcore.reflect.ListOfTypes.getResolvedTypes(ListOfTypes.java:55)
W/System.err:     at libcore.reflect.ParameterizedTypeImpl.getResolvedType(ParameterizedTypeImpl.java:71)
W/System.err:     at libcore.reflect.Types.getType(Types.java:56)
W/System.err:     at java.lang.reflect.Method.getGenericReturnType(Method.java:253)
W/System.err:     at retrofit2.ServiceMethod$Builder.createCallAdapter(ServiceMethod.java:221)
W/System.err:     at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:159)
W/System.err:     at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
W/System.err:     at retrofit2.Retrofit.invoke(Retrofit.java:145)
W/System.err:     at $Proxy0.getCalendar(Native Method)
W/System.err:     at com.wear.sms.smswearschool.LoadingPage.RetrofitLoad(LoadingPage.java:108)
W/System.err:     at com.wear.sms.smswearschool.LoadingPage.Delete_DB(LoadingPage.java:380)
W/System.err:     at com.wear.sms.smswearschool.LoadingPage.onCreate(LoadingPage.java:70)
W/System.err:     at android.app.Activity.performCreate(Activity.java:5231)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
W/System.err:     at android.app.ActivityThread.access0(ActivityThread.java:135)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:136)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5017)
W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err:     at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
W/System.err:     at dalvik.system.NativeStart.main(Native Method)
W/System.err: Caused by: java.lang.ClassNotFoundException: Models.ResultModel
W/System.err:     at java.lang.Class.classForName(Native Method)
W/System.err:     at java.lang.Class.forName(Class.java:251)
W/System.err:     at libcore.reflect.ParameterizedTypeImpl.getRawType(ParameterizedTypeImpl.java:61)
W/System.err:   ... 28 more
W/System.err: Caused by: java.lang.NoClassDefFoundError: Models/ResultModel
W/System.err:   ... 31 more
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "Models.ResultModel" on path: DexPathList[[zip file "/data/app/com.wear.sms.smswearschool-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.wear.sms.smswearschool-2, /vendor/lib, /system/lib]]
W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
W/System.err:   ... 31 more

我现在不知道错误在哪里,我在互联网上搜索但没有答案,所以这是我的应用程序 gradle 如果有人有任何想法请告诉我,这对我来说非常重要 :) 谢谢大家

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        applicationId "com.wear.sms.smswearschool"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 4
        versionName "1.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

repositories {
    maven { url "https://jitpack.io" }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
//    testCompile 'junit:junit:4.12'
//    compile 'com.android.support:appcompat-v7:23.1.1'4
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:multidex:1.0.1'

    compile 'com.github.PhilJay:MPAndroidChart:v2.1.3'
    compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.google.android.gms:play-services:8.1.0'

    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'

    compile 'com.twotoasters.jazzylistview:library:1.2.1'
    compile 'com.twotoasters.jazzylistview:library-recyclerview:1.2.1'

    compile 'se.emilsjolander:stickylistheaders:2.7.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.0'
//    Calender
    compile 'me.nlmartian.silkcal:library:0.1.1'
    ///
    compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
    //
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:recyclerview-v7:21.1.0'
    compile 'com.pushbots:pushbots-lib:2.0.13@aar'
    compile 'com.android.support:support-v4:21.1.0'
}

我看到你使用 multiDexEnabled true。对于 API < 20,您必须使用 multidex 支持库。检查 doc.

我想你错过了 Application 的部分。
如果您没有自定义 Application class:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>

否则,扩展 MultiDexApplication:

public class MyApplication extends MultiDexApplication { ... }

或...

public class MyApplication extends SomeOtherApplication {
  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(context);
     Multidex.install(this);
  }
}

如果您已经这样做了:

Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.