Failed to transform file '45907c80e09917e1b776adf038505958' to match attributes {artifactType=jar} using transform AarTransform
Asked Answered
M

5

11

I am using Android 3.0 canary 4 and making an app. Everything was working fine until yesterday, but today when i opened the project, it gave me an error

 F:\test projects\SellIT\app\build.gradle
Error:Failed to resolve: Failed to transform file '45907c80e09917e1b776adf038505958' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file '0424053f6b3433893454e7542cca3a9d' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'customtabs-25.0.0.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'recyclerview-v7-25.4.0.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'b7ae5d97f624a2ac68ed171c25f74f21' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'firebase-analytics-impl-10.2.4.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file '8a727da2aab64813ae6d20842b03d41f' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'support-compat-25.4.0.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

Error:Failed to resolve: Failed to transform file 'd0da7bf76907aa33e493551504efa952' to match attributes {artifactType=jar} using transform AarTransform
<a href="openFile:F:/test projects/SellIT/app/build.gradle">Open File</a>

this is my build.gradle (app level)

    apply plugin: 'com.android.application'


android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "android.sellit"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.4.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:10.2.4'

    // Required only if Facebook login support is required
    implementation('com.facebook.android:facebook-android-sdk:4.22.1')
    implementation 'com.google.firebase:firebase-core:10.2.4'
    implementation 'com.google.firebase:firebase-database:10.2.4'
    implementation 'com.google.android.gms:play-services-auth:10.2.4'
    implementation 'com.android.support:design:25.4.0'

    implementation 'com.github.bumptech.glide:glide:4.0.0-RC1'

    implementation 'com.google.firebase:firebase-storage:10.2.4'

    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.google.firebase:firebase-crash:10.2.4'

    implementation 'com.google.firebase:firebase-ads:10.2.4'
}
apply plugin: 'com.google.gms.google-services'

Has anyone encountered a similar error or he knows what can I do?

Monck answered 17/7, 2017 at 7:32 Comment(10)
thanks for the edit @PancizMonck
I had a similar error where it says "Failed to transform file 'uninstalltiontracking.jar' to match attributes {artifactType=android-classes} using transform JarTransform" on switching to android studio 3Attitude
so how did you solve it @PenduDevMonck
ya! i noticed that the .jar file was actually not present in the libs directory, so I removed the line implementation...uninstallationtracking.jar from the modules gralde file.Attitude
Have you tried Invalidate Cache and Restartoption in the File menuAttitude
@Attitude I have tried it, but still there is the error, and in my case,the project was working fine till the night before and the error is consistent even if I create a new project.Monck
U can try this brute force way to pinpoint ur error. 1. Create a new empty project. 2. Add the gradle lines one by one and compile after each line is added. 3. You will know which line is causing the problem . worth trying. Plus. Google libs are least likely to cause the prob, so try the other libs firstAttitude
all my dependencies are causing problems, even the default appcompact and constraint layout dependencies. I tried removing these and sync the project, but then it gave me other errors in my project.Monck
you can try a fresh install of android studioAttitude
Yeah, I was trying to avoid it, trying to find a solution of the problem. But i guess, I'll have to reinstall it finally.Monck
M
27

It turns out that this is a weird bug in the Gradle itself. I posted it on google forum and one of their coders gave me a solution and also put it up as an issue with the gradle team.

For the solution, you can clear your project cache (C:\Users\<username>\.gradle\caches\transforms-1 ) and rebuild your project again and it will work fine. The gradle needs some artifacts to build which are stored in the cache memory. So if the gradle fails to build, the cache can be cleared which will prompt fresh downloading. You can be offline as long as all the artifacts you need have been downloaded in Gradle's cache (so don't delete the cache folder when offline!)

Monck answered 7/8, 2017 at 18:6 Comment(4)
Anything else you had to do @anuj? Clearing transforms-1 folder seems to not resolve the issue.Tentage
Clearing the cache folder folder worked fine for me. Try clearing the other cache files too present in the caches folder. Don't worry, anything u delete in cache will be downloaded when u open Android studio again. Also make sure you are connected to internet when u start your Android studio.Monck
i tried all the methods. didn't work for me. clear cache folder, invalidate cache and restart, reinstall android studio. nothing worked for me. help me pleaseLayne
In my case the error was, the file path of the library folder was too long and that's why it couldn't find file. Moving project to the outermost folder of drive solved my problem.Saintmihiel
W
4

Faced the same issue. The simple way to solve this is to switch between your build variants. This refreshes the cached copies and resolves the issue.

Willtrude answered 23/5, 2018 at 8:9 Comment(0)
C
2

The error seems to be caused by corrupt Jetified files.

Delete ONLY the corrupted .jars from the error message from the Gradle caches folder:

rm ~/.gradle/caches/modules-2/files-2.1/path-to/some-release.aar

The "path-to" will be probably be the package name e.g., com.example.somerelease

Usually I get the path of the file to delete from the error message itself and cut and paste it into the terminal in order to execute the rm command.

Deleting the entire folder is not an optimal solution as all the dependencies will need to be Jetified again. If you're already having corruption issues, you're likely to encounter the issue again as there is more work for Jetify when it has to reprocess the entire folder

Commixture answered 23/5, 2019 at 3:52 Comment(0)
M
1

Received similar error:

Failed to transform file 'uat-release.jar' to match attributes {artifactType=android-classes} Transform output file D:\R\project\uat-release.jar does not exist.

In my case, Actual file was aar and bymistake I put .jar in build.gradle(of uat-release module)

  configurations.maybeCreate("default")
  artifacts.add("default", file('uat-release.jar'))

Solved it by correcting file type:

  configurations.maybeCreate("default")
  artifacts.add("default", file('uat-release.aar'))
Moquette answered 7/3, 2018 at 9:18 Comment(3)
Hi, under build.gradle, in which block do i put this code?Remitter
When u add aar as a module, it creates build.gradle in that module. Put it there.Moquette
That's right, and here is the example: in github.com/textileio/notes/commit/… , compile project(':mobile') in android/app/build.gradle , configurations.maybeCreate("default") in android/mobile/build.gradle , include ':mobile' in android/settings.gradleAfroamerican
H
0

go to destination : Android\sdk\platforms\android-30\android.jar. and delete what inside android-jar and rebuild project and sync worked for me .

Hero answered 31/3, 2021 at 23:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.