Build Failure - 'okhttp-3.14.0.jar'

Asked

Viewed 93 times

2

Perhaps someone has already stumbled upon this mistake:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
 > Failed to transform file 'okhttp-3.14.0.jar' to match attributes 
    {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=16} using 
    transform DexingTransform
 > Error while dexing.

Thank you in advance!

  • Hello @Caue, welcome to Sopt, I noticed by reading your comment that you have found a solution to your problem other than that proposed by the community. If you add an answer showing how you solved it would be of great help to people in the community who have the same problem. Don’t forget to take a look at our [Tour]. = D

  • I took the following steps: 1- CLICK "FILE" ; 2- CLICK IN THE "APP" FOLDER; 3- CLICK LEFT OR CLICK F4; CHANGE SOURCE COMPATIBILITY AND TARGET COMPATIBILITY FOR VERSION 1.8, REFENTE AO JAVA INSTALADO.

1 answer

0

Import the file okhttp-3.14.0.jar, if it has dependencies also import dependencies, to libs.

In the archive build.gradle:

allprojects {
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

dependencies {

    // Adicione essa linha e mantenha as já existentes
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

}

PS: I was reading the documentation from OkHttp and he is dependent on Okio on the very page of OkHttp has the link to Okio. If you haven’t downloaded it, download the jar containing the Okio and import into libs.

  • 1

    THANK YOU VERY MUCH FOR RESPONDING, CAN RESOLVE BY ADDING THIS LINE IN GRADLE: compileOptions { sourceCompatibility Javaversion.VERSION_1_8 targetCompatibility Javaversion.VERSION_1_8

Browser other questions tagged

You are not signed in. Login or sign up in order to post.