gpt4 book ai didi

安卓工作室错误 : static interface method invocations are not supported in -source 1. 7

转载 作者:行者123 更新时间:2023-11-29 00:13:18 26 4
gpt4 key购买 nike

Error:(100, 48) error: static interface method invocations are not supported in -source 1.7 (use -source 8 or higher to enable static interface method invocations)

该行看起来像这样:

field = SomeInterface.someMethod("","","");

和界面:

public interface SomeInterface extends AnotherInterface {
public static SomeInterface someMethod(String arg1,String arg2,String arg3) throws IOException {
return someMethod(arg1,arg2,arg3,SOME_CONSTANT,ANOTHER_CONSTANT);
}
}

如何解决这个问题?

最佳答案

由于静态接口(interface)方法调用是在 Java 8 中引入的,因此您必须 add the Java 8 compatibility options在您的 build.gradle 文件中启用 Java 8 语言功能:

android {
...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

关于安卓工作室错误 : static interface method invocations are not supported in -source 1. 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28630332/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com