我正在尝试将 epub 阅读器库添加到我已经创建的项目中。我试图作为模块添加到我的项目中的库是 Folio Reader Library ( https://github.com/FolioReader/FolioReader-Android )。我已经在我的电脑上下载了这个库,并尝试通过文件 -> 新建 -> 导入模块添加它。但是,在此过程中我收到此错误:
ERROR: Plugin with id 'kotlin-android' not found.
Run Code Online (Sandbox Code Playgroud)
该文件位于 Folio Reader 库的 build.gradle 文件中。
build.gradle 文件:
apply plugin: 'com.android.library'
apply from: '../config/quality/quality.gradle'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
ext {
bintrayRepo = 'maven'
bintrayName = 'folioreader'
publishedGroupId = 'com.folioreader'
libraryName = 'FolioReader'
artifact = 'folioreader'
libraryDescription = 'An epub reader for Android'
siteUrl = 'https://github.com/FolioReader/FolioReader-Android'
gitUrl = 'https://github.com/FolioReader/FolioReader-Android.git'
libraryVersion = versions.folioreaderSdk
developerId = 'mobisystech'
developerName …Run Code Online (Sandbox Code Playgroud) 我试图存储一个布尔值,每次单击按钮时都会更改该值。我想使用共享首选项来执行此操作,但是我一直遇到此错误:未解析的引用:getPreferences
这是我的代码:
btnStyle.setOnClickListener() {
styleHasChanged = !styleHasChanged;
if(styleHasChanged == true){
btnStyle.setText("true")
}else{
btnStyle.setText("false")
}
// AppUtil.saveConfig(activity, config)
// EventBus.getDefault().post(ReloadDataEvent())
var sharedPref : SharedPreferences = this.getPreferences(Context.MODE_PRIVATE);
var editor = sharedPref.edit()
editor.putBoolean("bla", styleHasChanged)
editor.commit()
}
Run Code Online (Sandbox Code Playgroud)