java.lang.NoClassDefFoundError:使用引导类加载器找不到类;没有可用的堆栈

时间:2017-12-21 10:30:29

标签: android noclassdeffounderror classnotfoundexception

我正在使用带有Unity Integration的Android项目,它显示了   NoClassDefFoundError:使用引导类加载器找不到类; Lolipop及以下和上层版本中没有可用的堆栈   工作顺利,没有错误,我尝试启用和禁用即时运行,但它仍然给我同样的问题。

这是我的代码:

apply plugin: 'com.android.application'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.parse:parse-android:1.10.3'
compile(name: 'animated-vector-drawable-23.4.0', ext: 'aar')
compile(name: 'cardboard_android_common', ext: 'aar')
compile(name: 'cardview-v7-23.4.0', ext: 'aar')
compile(name: 'customtabs-23.4.0', ext: 'aar')
compile(name: 'facebook-android-sdk-4.17.0', ext:'aar')
compile(name: 'facebook-android-wrapper-7.9.4', ext: 'aar')
compile(name: 'firebase-app-unity-3.0.1', ext: 'aar')

compile(name: 'support-v4-24.0.0', ext: 'aar')
compile(name: 'support-vector-drawable-23.4.0', ext: 'aar')
compile(name: 'unityvractivity', ext: 'aar')



compile project(':Firebase')
compile project(':firebase-common-10.2.0')
compile project(':firebase-iid-10.2.0')
compile project(':firebase-messaging-unity-3.0.1')
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}


android {

compileSdkVersion 26
buildToolsVersion '26.0.1'

defaultConfig {
    android.defaultConfig.vectorDrawables.useSupportLibrary = true
    minSdkVersion 19
    targetSdkVersion 23

    applicationId 'se.inceptive.VRConferenceTelia'
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

lintOptions {
    abortOnError false
}
signingConfigs {
    release {
        storeFile file('/home/emilence/Downloads/assets/VRAPP.keystore')
        storePassword ''
        keyAlias 'emilence'
        keyPassword ''
    }
}

buildTypes {
    debug {
        jniDebuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
        signingConfig signingConfigs.release
    }
}

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    all*.exclude group: 'com.android.support', module: 'support-
 annotations'

   }

  dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = true
    }
   sourceSets {
    main {
        java.srcDirs = ['src/main/java', 'src-gen/main/java']
    }
  }
  }
  dependencies {
    compile "com.google.android.gms:play-services-base:10.2.0"
    compile "com.google.android.gms:play-services-basement:10.2.0"
    compile "com.google.android.gms:play-services-tasks:10.2.0"
    compile 'com.google.android.gms:play-services:10.2.0'

    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'


    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'pub.devrel:easypermissions:0.4.0'
    compile 'com.vanniktech:emoji-google:0.5.1'
    compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
    compile ('io.socket:socket.io-client:1.0.0') {
        exclude group: 'org.json', module: 'json'
    }
    compile 'nl.psdcompany:duo-navigation-drawer:2.0.6'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0'
    compile 'id.zelory:compressor:2.1.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.github.clans:fab:1.6.4'
    compile 'com.android.support:design:23.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.android.support:multidex:1.0.0'
    compile project(':videocompressor')


}

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

2 个答案:

答案 0 :(得分:0)

您是否为Application类实现了multidex?它可以发行。

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

答案 1 :(得分:0)

您的问题可能是由于线路引起的

compile 'com.google.android.gms:play-services:10.2.0'
在应用模块的build.gradle中

。 这些行添加了所有Google Play服务库,而对于单个apk来说它们太多了;因此,尝试仅下载精确的库,例如

compile "com.google.android.gms:play-services-base:10.2.0"
compile "com.google.android.gms:play-services-basement:10.2.0"
compile "com.google.android.gms:play-services-tasks:10.2.0"

因此,删除该行,清理项目或删除构建文件夹,然后再次运行您的应用程序

请记住用compile来更改implementation