Dan*_*ung 6 java android java-8
我正在使用的库是bychan,我甚至无法将它包含在Nougat空应用程序项目中,无论是作为模块加载还是通过jar加载.
所以这是Android Studio消息中返回的内容的示例:
有人可以在下面的错误中解释"未知界面"的含义吗?
Error:TokenDefinitionBuilder.java:118-119: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Function
Error:TokenDefinitionBuilder.java:118-119: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Predicate
...
Error:com.android.jack.JackAbortException
Run Code Online (Sandbox Code Playgroud)
这来自我用过的图书馆.我认为在尖括号中添加类型会有帮助吗?我不知道它是否做了什么.
这是该库中的第118-119行:
strings.stream().<StringMatcher>map(StringMatcher::new).map(
m -> m.tryMatch(input, searchStart)).filter(Objects::nonNull).findFirst().orElse(null));
Run Code Online (Sandbox Code Playgroud)
我不确定它在抱怨什么?我该怎么办或改变以逃避这个问题?我原以为Android可能不支持Lambda表达式,但错误清楚地表明"Lambda来自......",这意味着它认识到我使用了lambda表达式.
请帮忙.
我已经通过在另一个jar库中的jar中编译它来包含库,如果这有帮助的话.如果你不知道的话,我是Android新手.
我认为这与API版本无关?我已将构建目标设置为25.但构建仍然失败.
另外,如果你看下面,我没有看到1.8的选项?但我已将构建JDK设置为我的1.8 JDK位置.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "this.is.where.i.have.my.id"
minSdkVersion 25
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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:25.0.1'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:preference-v7:25.0.0'
compile 'com.android.support:preference-v14:25.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.8.0'
compile files('libs/my_lib_that_contains_lambda.jar')
}
Run Code Online (Sandbox Code Playgroud)
我不建议使用java 8。现在不支持它。但是,即使如此,它也会:记住,每个设备都有自己的 java 机器,不会更新。我的意思是,如果你想确保你的应用程序正常工作,请将你的项目设置为 java 6。旧设备永远不支持最新的 JMV
也阅读此讨论
Android Studio 需要哪个 JDK 版本(语言级别)?
| 归档时间: |
|
| 查看次数: |
5158 次 |
| 最近记录: |