当前位置: 代码迷 >> 综合 >> ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'
  详细解决方案

ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

热度:33   发布时间:2023-09-07 06:58:15.0

个问题一般是由老项目升级出现的问题,比如老项目的gradle4.0以下的升级到gradle4.6,或者更高5.3.2等,这个升级的过程中,就会出现很多问题,比如下面这个:

ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
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. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

油刀是一个很好用的第三方框架,更新也是与时俱进,一般和gradle版本号也是一一对应的关系,比如gradle4.6对应butterknife8.8.1,。
面这个问题大都是butterknife依赖出现问题了,下面讲解决方法。

第一步:

把butterknife注释掉,别问太多的,因为butterknife依赖从出现问题,导致其他依赖暂时无法进行更新,所以,把在gradle相关butterknife依赖都注释掉(代码里面的不要管,这里只是gradle的),把其他的依赖先依赖好。让gradle顺利升级。
ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'
ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

第二步:

第一步之后,记得同步一下。之后找到与gradle版本对应的butterknife从新正常依赖即可。比如现在的butterknife10.1.0对应gradle5.0以上的版本。

  相关解决方案