今天在项目里使用了RxPermissions的时候, 突然发现回调的时候需要用到granted -> 这么一个方法.
然而在度娘里搜到的方法全部都是用这个东西, 于是便把这个方法搬到自己项目了, 结果报错了.
错误如下:
Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.
解决办法:
在app的build.gradle中的defaultConfig里添加一行代码:
jackOptions {
enabled true;
}
defaultConfig {
applicationId "com.test.xxx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true;
}
}
由此记录存档. 希望可以帮到一些有需要的朋友.