java.lang.NoSuchMethodError:没有虚方法

时间:2016-09-05 10:43:16

标签: android dex

当我尝试使用两个具有普通类的库时,我真的陷入了解决此错误的问题。

  
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.test.orevon.realiteaugmente, PID: 9091
                  java.lang.NoSuchMethodError: No virtual method startCapture(Lcom/craftar/CraftARActivity;)Z in class Lcom/craftar/CraftARSDK; or its super classes (declaration of 'com.craftar.CraftARSDK' appears in /data/data/com.test.orevon.realiteaugmente/files/instant-run/dex/slice-craftar-cloud-image-recognition-sdk-android_2ef54569b311add10fb3d70edb330f83d008ee0d-classes.dex)
                      at com.test.orevon.realiteaugmente.MainActivity.onPostCreate(MainActivity.java:89)
                      at com.craftar.CraftARActivity.onCreate(CraftARActivity.java:61)
                      at com.test.orevon.realiteaugmente.MainActivity.onCreate(MainActivity.java:63)
                      at android.app.Activity.performCreate(Activity.java:6876)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                      at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:158)
                      at android.app.ActivityThread.main(ActivityThread.java:7224)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

我认为这个问题与multidex有关,但我无法得到解决方案,我试图将此代码添加到我的gradle文件中

    
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.test.orevon.realiteaugmente"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/MANIFEST.MF'
        exclude 'META-INF/NOTICE'
    }
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile files('libs/slider.jar')
}

但它无法解决问题

0 个答案:

没有答案