[英]How to resolve event log “all files are up-to-date” in Android Studios
[英]How to resolve 'readLines' error in Android Studios
我目前正在 Android Studios 上使用 Java 构建应用程序,但我遇到了问题。
items = new ArrayList<>(FileUtils.readLines(getDataFile(), Charset.defaultCharset()));
我从这一行收到一条错误消息,说“无法解析方法 readLines”
我的build.gradle中的依赖如下
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'commons-io:commons-io:2.6' //First tried this one
implementation 'org.apache.commons:commons-io:1.3.2' //Then tried this one
}
下面两行是我试图用来解决问题的,但我仍然收到错误。
我也有import android.os.FileUtils;
在我的 java class 但仍然没有。 请帮忙!
利用
import org.apache.commons.io.FileUtils;
为我工作。
尝试从https://commons.apache.org/proper/commons-io/dependency-info.html implementation 'commons-io:commons-io:2.11.0'
。 然后像这样导入它到你的项目中import org.apache.commons.io.FileUtils;
. 确保您没有导入android.os.FileUtils 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.