Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tried to access method com.google.common.io.Files.fileTreeTraverser() from class com.android.utils.FileUtils

Tags:

android

I am getting below error after merge support library in androidx.

Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.io.Files.fileTreeTraverser()Lcom/google/common/collect/TreeTraverser; from class com.android.utils.FileUtils
    at com.android.utils.FileUtils.getAllFiles(FileUtils.java:394)
    at com.android.build.gradle.internal.transforms.StripDebugSymbolTransform.transform(StripDebugSymbolTransform.java:188)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
    ... 31 more

This problem is occurred after androidx merge. looks like that the problem seems to be in accessing the method Files.fileTreeTraverser() from class FileUtils.

Any ideas why its coming and how to fix it, please?

like image 383
Sushil Solanki Avatar asked Dec 04 '22 18:12

Sushil Solanki


1 Answers

I resolved issue by updating

  • gradle build tool version

    classpath 'com.android.tools.build:gradle:3.4.2'

  • gradle wrapper properties file

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

  • Kotlin version to 1.3.10 or higher

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10"

like image 134
Shahab Rauf Avatar answered Dec 06 '22 10:12

Shahab Rauf