首页 > 解决方案 > 将 weka 与 android 一起使用时出现错误

问题描述

我试图用 android 添加 weka 但得到了这些错误。我应该说,当我运行包含我所有 weka 代码的类时,它运行得很好,但是当我使用其中一个活动调用这个类时,我得到了错误。

Invoke-customs 仅支持从 Android O (--min-api 26) 开始 Message{kind=ERROR, text=Invoke-customs 仅支持从 Android O (--min-api 26), sources=[Unknown source文件],工具名称=Optional.of(D8)}

我寻找了一个解决方案,我发现您必须将这些行放入 gradle

        android { 
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

当我这样做时,错误已更改为:

引起:java.lang.IllegalAccessException:没有这样的方法:weka.gui.SimpleCLIPanel.lambda$initFinish$0()void/invokeSpecial

引起:java.lang.VerifyError:操作数堆栈上的类型错误

这是 gradle 中的整个 android 块

android {

compileSdkVersion 28
defaultConfig {
    applicationId "com.example.sulimanhassan.fakenewsdetection"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

请问有什么帮助吗?

标签: javaandroidcompilationweka

解决方案


推荐阅读