Gradle - Null extracted folder for artifact: ResolvedArtifact
Asked Answered
P

9

25

I've the following line in my gradle android project inside the module build.gradle

dependencies {
 // a lot of dependencies
 implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT'
}

and it causes the gradle build to fail with the following error

Null extracted folder for artifact: ResolvedArtifact(componentIdentifier=org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT:20210331.060351-75, variantName=null, artifactFile=C:\Users\USER\.gradle\caches\modules-2\files-2.1\org.tensorflow\tensorflow-lite-select-tf-ops\0.0.0-nightly-SNAPSHOT\b03a88bda4ad93e6fefe285f9ea303d28433eacc\tensorflow-lite-select-tf-ops-0.0.0-nightly-SNAPSHOT.aar, extractedFolder=null, dependencyType=ANDROID, isWrappedModule=false, buildMapping={__current_build__=C:\Users\USER\Desktop\Myapp2}, mavenCoordinatesCache=com.android.build.gradle.internal.ide.dependencies.MavenCoordinatesCacheBuildService$Inject@5c4450a)

I had the same implementation in a diffrent project and it worked but in this project this error keep on appearing.

what causes this error? and how can I fix it?

Poacher answered 16/6, 2021 at 10:1 Comment(0)
I
42

I got the same error when I was adding aar. I changed the implementation path and then fixed.

old path

implementation files('libs/test.aar')

new path

implementation files('../libs/test.aar')

Intestine answered 23/6, 2021 at 13:42 Comment(4)
How implementation path can be changed?Leonidaleonidas
I am getting same error even after changing the pathPianette
for me was the other way around ... "old path" is the new and the "new path" was the way I had it and was throwing an error.Covenant
And if you are adding the dependency to a module, new path would be more like implementation files('../modulenamehere/libs/test/aar')Arnoldarnoldo
I
38

In my case I had to increase amount of RAM to 4096 in gradle.properties:

org.gradle.jvmargs=-Xmx4096M

After that project synced correctly.

India answered 12/7, 2022 at 11:44 Comment(0)
G
8

I got the error when I was adding unit-ads.aar . I changed this in my code and its works for me.

Old Code

implementation files('../libs/unity-ads.aar')

New Code

implementation files('libs/unity-ads.aar')
Gamma answered 30/9, 2021 at 13:31 Comment(0)
F
2

In my case I had to go to the equivalent folder:

C:\Users\USER\.gradle\caches\modules-2\files-2.1\org.tensorflow\tensorflow-lite-select-tf-ops

And delete it, then try to sync again, and worked.

Flank answered 7/7, 2022 at 11:31 Comment(0)
C
1

You must check the path well for example:

implementation(files("./src/libs/myfile.aar")) 

or

implementation files("./src/libs/myfile.aar")
Cruller answered 21/7, 2022 at 2:30 Comment(0)
R
0

Well, you can be more explicit like this.

implementation files("$rootProject.projectDir/libs/test.aar")
Rode answered 18/1, 2022 at 10:18 Comment(0)
N
0

When importing arr/jar to AS, I have encountered this issue. My method is switching Project view to Project mode (not Android mode) and after that add aar/jar to libs folder (or any folder)

dotrinh

Naara answered 22/9, 2022 at 12:25 Comment(0)
F
0

In my case, an Artifact error was generated After Project migrated from Android to AndroidX

Error was

Null extracted folder for artifact: ResolvedArtifact(componentIdentifier=androidx.activity:activity:1.8.0, variantName=null, artifactFile=/home/mittal/.gradle/caches/modules-2/files-2.1/androidx.activity/activity/1.8.0/4266e2118d565daa20212d1726e11f41e1a4d0ca/activity-1.8.0.aar, extractedFolder=null, dependencyType=ANDROID, isWrappedModule=false, buildMapping={__current_build__=/home/mittal/StudioProjects/android/android-sdk}, mavenCoordinatesCache=com.android.build.gradle.internal.ide.dependencies.MavenCoordinatesCacheBuildService$Inject@6fbb61c0)

Excluding Activity library from material dependencies solved the error

    implementation ('com.google.android.material:material:1.10.0') {
    exclude group: 'androidx.activity', module: 'activity'
}

So if you are facing the artifact error then check the library mentioned in the error and Try removing that library may help you.

Flowerer answered 7/11, 2023 at 9:40 Comment(0)
D
0
implementation 'androidx.activity:activity:1.8.0' 

Remove this line from gradle.build and resolve the issue

Declination answered 23/4 at 11:21 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Lucius

© 2022 - 2024 — McMap. All rights reserved.