Andriod开发学习笔记(2)--开发工具错误解决
导入一个android工程时,出现了以下两条错误:Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.ERROR: Unable to find method 'org.gradle.api.tasks.TaskInputs.
导入一个android工程时,出现了以下两条错误:
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
ERROR: Unable to find method 'org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt
Cannot load settings from file 'G:\Android\sample\enjoyshop\zhiwen-enjoyshop.iml': File G:\Android\sample\enjoyshop\zhiwen-enjoyshop.iml does not exist Please correct the file content
试了多种方法,现将有效方法记录一下。
首先,查看build.gradle,发现该工程需要依赖greenrobot和bugly的插件,而我的环境中没有安装。
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.novoda:bintray-release:0.8.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
classpath "com.tencent.bugly:tinker-support:1.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
添加必须的插件后,下边的错误就没有了。
ERROR: Unable to find method ‘org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;’
…
插件的添加方法:
1)进入file->settings->plugins,选中marketplace,在搜索栏里输入需要添加的插件名字(如图)。
2)需要的插件筛选出后,点击install,进行安装。
3)安装完成后,点击restart IDE重启AS
查了很多资料,有说插件版本与当前环境不一致导致出现问题的,但又不想一个一个插件查看版本,因此给每一个插件版本指定为latest.release,拉取最新版本。
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.novoda:bintray-release:latest.release'
classpath 'org.greenrobot:greendao-gradle-plugin:latest.release'
classpath "com.tencent.bugly:tinker-support:latest.release"
然后又出现了新的错误:
0:00 Gradle sync failed: Invalid file found (empty apk data).
Try to remove G:\Android\sample\enjoyshop\app\build\outputs\apk\debug\output.json or clean your build directory.
If the error persists, report this issue via Help > Submit Feedback.
Consult IDE log for more details (Help | Show Log) (1 s 837 ms)
按照提示,我clear了一下工程:Build->(下拉)clear project,然后重新sync一下,终于加载成功了。
更多推荐
所有评论(0)