3

如果我禁用即时运行一切正常,但如果我启用它,则会从 android gradle 2.2.3 on wards 收到以下错误。请在下面找到错误日志

AndroidRuntime: FATAL EXCEPTION: main
Process: com.click2clinic.clinicopedia, PID: 22314
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat;
at android.support.v4.content.ContextCompat.isDeviceProtectedStorage(ContextCompat.java:565)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1740)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1715)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5029)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4624)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4564)
at android.app.ActivityThread.access$1500(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5290)
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:911)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.os.BuildCompat" on path: DexPathList[[zip file "/data/app/com.click2clinic.clinicopedia-2/base.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.click2clinic.clinicopedia-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.click2clinic.clinicopedia-2/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 android.support.v4.content.ContextCompat.isDeviceProtectedStorage(ContextCompat.java:565) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1740) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1715) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5029) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4624) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4564) 
at android.app.ActivityThread.access$1500(ActivityThread.java:154) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5290) 
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:911) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706) 
Suppressed: java.lang.ClassNotFoundException: android.support.v4.os.BuildCompat
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)
... 22 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

摇篮

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.2'
    defaultConfig {

        minSdkVersion 16
        targetSdkVersion 23
        versionCode 25
        versionName "1.0.24"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

//    splits {
//        abi {
//            enable true
//            reset()
//            include 'x86', 'arm64-v8a', 'armeabi-v7a', 'x86_64'
//            universalApk false
//        }
//    }

    lintOptions {
        abortOnError false
    }

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

    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'
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        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:24.2.1'
        compile 'com.android.support:cardview-v7:24.2.1'
        compile 'com.android.support:recyclerview-v7:24.2.1'
        compile 'com.android.support:support-v4:24.2.1'
        compile 'com.android.support:design:24.2.1'
        compile 'com.android.support:palette-v7:24.2.1'
        testCompile 'junit:junit:4.12'

        compile 'com.squareup.retrofit2:retrofit:2.2.0'
        compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
        //compile 'com.squareup.okhttp3:okhttp:3.6.0'
        //compile 'com.squareup.okhttp:okhttp:2.4.0'
        compile 'com.squareup.okhttp3:okhttp-urlconnection:3.6.0'
        compile 'com.squareup.okhttp3:okhttp:3.6.0'
        compile 'com.squareup.retrofit2:converter-gson:2.1.0'
        compile 'de.hdodenhof:circleimageview:2.0.0'
        compile 'com.mcxiaoke.volley:library:1.0.19'
        compile 'com.google.code.gson:gson:2.8.0'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.ogaclejapan.smarttablayout:library:1.6.0@aar'
        compile 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.0.4'

        compile 'com.google.android.gms:play-services:10.0.0'
        compile 'com.google.android.gms:play-services-maps:10.0.0'
        compile 'com.google.android.gms:play-services-location:10.0.0'
        compile 'com.google.android.gms:play-services-analytics:10.0.0'
        compile 'com.google.android.gms:play-services-auth:10.0.0'
        compile 'com.google.firebase:firebase-invites:10.0.0'

        compile('org.apache.httpcomponents:httpcore:4.4.1') {
            exclude group: 'org.apache.httpcomponents', module: 'httpclient'
            compile project(':appcoreutils')
            compile 'com.inkapplications.viewpageindicator:library:2.4.3'
            compile 'com.android.support:multidex:1.0.1'
            compile 'com.google.code.gson:gson:2.8.0'
        }
        compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
            transitive = true;
        }
        compile 'com.google.firebase:firebase-core:10.0.0'
        compile 'com.google.firebase:firebase-messaging:10.0.0'
        compile 'com.google.firebase:firebase-analytics:10.0.0'
        compile project(':appcoreutils')
        compile files('libs/signalr-client-sdk-android.jar')
        compile files('libs/signalr-client-sdk.jar')
        compile files('libs/YouTubeAndroidPlayerApi.jar')
        compile 'com.android.support:multidex:1.0.1'
        compile 'com.facebook.android:facebook-android-sdk:4.+'
        compile project(':sdkui')
        compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'

        /*quick blox video chat*/

        compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.3.0'

        compile 'com.android.support:support-annotations:24.2.1'
        compile 'com.navercorp.pulltorefresh:library:3.2.3@aar'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'com.quickblox:quickblox-android-sdk-messages:3.3.0'
        compile 'com.github.johnkil.android-robototextview:robototextview:2.4.3'
        compile 'com.squareup.okhttp:okhttp:2.7.0'
        compile 'com.jakewharton:butterknife:5.1.1'
        compile 'org.jsoup:jsoup:1.10.2'

        compile 'com.google.maps.android:android-maps-utils:0.5+'
        compile 'com.github.baoyachi:StepView:1.9'



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

尝试了很多来找到解决方案并且花了一个多星期但无法解决它,有人可以帮助我解决问题。如果您需要更多详细信息,请在下方评论

4

1 回答 1

0

请 File->Invalid Cache and Restart 然后 Build->Clean Project,Build->Rebuild Project

如果您更新应用程序 build.gradle

classpath 'com.android.tools.build:gradle:2.3.1' 
于 2017-05-02T12:03:44.520 回答