'Failed to transform file 'nbi-stubs-1.0.0.aar' to match attributes'

I'm trying to build my version of ODK Collect but am getting the following error immediately upon attempting the build:

Executing tasks: [clean, :collect_app:assembleDebug] in project C:\Users\user name\StudioProjects\myapp

> Task :collect_app:clean UP-TO-DATE
> Task :collect_app:preBuild UP-TO-DATE
> Task :collect_app:preDebugBuild UP-TO-DATE
> Task :collect_app:compileDebugAidl NO-SOURCE
> Task :collect_app:generateDebugBuildConfig
> Task :collect_app:compileDebugRenderscript NO-SOURCE
> Task :collect_app:javaPreCompileDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':collect_app:javaPreCompileDebug'.
> Could not resolve all files for configuration ':collect_app:debugCompileClasspath'.
   > Failed to transform file 'nbi-stubs-1.0.0.aar' to match attributes {artifactType=android-classes, org.gradle.usage=java-api}
      > Execution failed for AarToClassTransform: C:\Users\user name\.gradle\caches\transforms-2\files-2.1\baa2ff57d32dcf5b33a59c5376456781\jetified-nbi-stubs-1.0.0.aar.
         > entry

Any idea how I can resolve this?

I have the build successfully working on one machine, but I get this error on my other machine and I'm unsure why - I cloned the repository from my GitHub repository which is up to date with commits pushed from the machine that is working.

Seems odd?

Ok, well I deleted the project and re-cloned it from GitHub and it worked this time.

Not sure why!

1 Like

@chewDK did you solve the problem, i'm having the same problem

@honoratt_mark_ocbina - yes I did, for some weird reason deleting the project and re-cloning it from GitHub fixed things. No idea why...

ohhh.. good for you @chewDK, odk collect?

i try it so many times but is not working with me @chewDK huhuhuh

Hi, sorry for the delay - yes it was ODK Collect for me.

I'm not sure how to resolve this I'm afraid - I think it may be something to do with the Gradle build?

Did you find a solution in the end?

As we noticed in Build failed - Cause: entry the problem takes place if you upgrade gradle versions. Don't do that for now if you want to avoid problems.

1 Like

Ah! Ok that makes sense, I must have upgraded the Gradle in my first clone and not in my second. Cheers!