问题
I tried to add weka with android but got these errors. I should say that when I run the class that contain all my weka code it runs perfectly but when I call this class using one of the activity I get the errors.
Invoke-customs are only supported starting with Android O (--min-api 26) Message{kind=ERROR, text=Invoke-customs are only supported starting with Android O (--min-api 26), sources=[Unknown source file], tool name=Optional.of(D8)}
I looked for a solution i found that you have to put these lines in gradle
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
when I did so the error has changed to :
Caused by: java.lang.IllegalAccessException: no such method: weka.gui.SimpleCLIPanel.lambda$initFinish$0()void/invokeSpecial
Caused by: java.lang.VerifyError: Bad type on operand stack
this is the whole android block in gradle
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
}
}
Any help please ?
来源:https://stackoverflow.com/questions/53419376/errors-when-using-weka-with-android