我的环境是使用了Buttekrnife的。
1.com.android.tools.r8.a: Static interface methods are only supported starting解决方法是加以下代码
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2.但是加了compileOptions之后之后程序闪退。所以我把annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
这行代码从子Module移到了主Module,就没事了。因为这是一个用来处理butteknife的注解的,没有在主Module添加的话,使用@BindView()获取的控件为null,然后就程序闪退了。
PS:如果子module也要用到butterknife的注解的话那就都加上。
- 子Module添加butterknife依赖:
api 'com.jakewharton:butterknife:10.2.1'
- 主Module添加butterknife注解处理器依赖:
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
- project的gradle文件
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
希望能帮到你。
如果有什么地方我没写清楚的请在下方留言。