Search code examples
javaandroidclasspathjschjcabi

Android Studio - Gradle failed to capture snapshot of input files for task 'mobile:javaPreCompileDebug'


Initially I was using the Jcabi library in my project. After finding the Jsch library, I decided to stop using Jcabi and made the unfortunate mistake of deleting the jcabi-ssh-1.6.1.jar inside my libs folder of my project:

AndroidStudioProjects/Project1/mobile/libs:
.
└── jsch-0.1.54.jar
    jcabi-ssh-1.6.1.jar

0 directories, 2 files

Now, when building the project, Gradle is returning some errors:

Transform output file /home/spoiledgoods/AndroidStudioProjects/Project1/mobile/libs/jcabi-ssh-1.6.1.jar does not exist.

org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task ':mobile:javaPreCompileDebug' property 'compileClasspaths' during up-to-date check.

...

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mobile:debugCompileClasspath'.

...

Caused by: org.gradle.api.artifacts.transform.ArtifactTransformException: Failed to transform file 'jcabi-ssh-1.6.1.jar' to match attributes {artifactType=android-classes} using transform JarTransform

...

Caused by: org.gradle.api.InvalidUserDataException: Transform output file /home/spoiledgoods/AndroidStudioProjects/Project1/mobile/libs/jcabi-ssh-1.6.1.jar does not exist.

Java is a new language for me, as well as Android Development in general, but it seems like it's still looking for the .jar file even though nothing from the library itself is used in the source code; if I "search everywhere" (double-shift), I find one instance of jcabi inside a file called Gradle____local_aars____[projectdirectory]_mobile_libs_jcabi_ssh_1_6_1_jar_unspecified_jar.xml with these contents:

<component name="libraryTable">
  <library name="Gradle: __local_aars__:/home/spoiledgoods/AndroidStudioProjects/Project1/mobile/libs/jcabi-ssh-1.6.1.jar:unspecified@jar">
    <CLASSES>
      <root url="jar://$PROJECT_DIR$/mobile/libs/jcabi-ssh-1.6.1.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>

Tried this one and this one which amount to disabling Instant Run (no luck)

I can post the entire stack trace if necessary!


Solution

  • Silly me, I should have looked in build.Gradle right away (I assumed that jcabi would not be inside due to the search not returning anything with the text "jcabi")

    After removing the line implementation files ('libs/jcabi') I was able to build successfully.