11

Trying to update my app to androidX dependencies. Followed instructions here, and compilation failed. The error came from JetifyTransform task failing to process a certain .JAR dependency (FYI - Samsungs Spass SDK) :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptGenerateStubsStandardNo_vendorDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:standardNo_vendorDebugCompileClasspath'.
   > Failed to transform file 'pass-v1.2.2.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
      > Failed to transform '/Users/hanandann/StudioProjects/ArnakPaymentsAndroid/Payments/app/libs/pass-v1.2.2.jar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)
   > Failed to transform file 'pass-v1.2.2.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
      > Failed to transform '/Users/hanandann/StudioProjects/ArnakPaymentsAndroid/Payments/app/libs/pass-v1.2.2.jar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)

Trying to jetify with jetifier-standalone tool had similar results:

Hanans-MacBook-Pro:bin hanandann$ ./jetifier-standalone -i /Users/hanandann/StudioProjects/.../app/libs/pass-v1.2.2.jar -o /Users/hanandann/StudioProjects/.../app/libs/pass-v1.2.2jet.jar 
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
    at org.objectweb.asm.ClassReader.readFrameType(ClassReader.java:2313)
    at org.objectweb.asm.ClassReader.readFrame(ClassReader.java:2269)
    at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1448)
    at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1126)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:698)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.android.tools.build.jetifier.processor.transform.bytecode.ByteCodeTransformer.runTransform(ByteCodeTransformer.kt:39)
    at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:443)
    at com.android.tools.build.jetifier.processor.archive.ArchiveFile.accept(ArchiveFile.kt:49)
    at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:425)
    at com.android.tools.build.jetifier.processor.archive.Archive.accept(Archive.kt:76)
    at com.android.tools.build.jetifier.processor.Processor.transformLibrary(Processor.kt:421)
    at com.android.tools.build.jetifier.processor.Processor.transform(Processor.kt:247)
    at com.android.tools.build.jetifier.processor.Processor.transform$default(Processor.kt:234)
    at com.android.tools.build.jetifier.standalone.Main.run(Main.kt:157)
    at com.android.tools.build.jetifier.standalone.Main$Companion.main(Main.kt:109)
    at com.android.tools.build.jetifier.standalone.Main.main(Main.kt)

Now, I don't really mind if SDK's don't get jetified, so I tried setting android.enableJetifier=false in my gradle.properties file, but compilation failed again for a different reason- SupportMapFragment isn't compatible with androidX yet as is reported here

So I'm stuck. With jetify the .JAR won't transform. with it - SupportMapFarg is incompatible.

Any suggestions?

P.S. you know what would be nice? if there was an ignore option for the jetifying function

1
  • I got same error because some lib jar file was "malformed" or something, which was a deprecation warning in Gradle 4 and a fatal error in Gradle 5. Downgrading to Gradle 4 solved the issue.
    – Klesun
    Dec 5, 2019 at 19:56

4 Answers 4

17

added this to gradle.properties:

android.jetifier.blacklist = pass

as suggested by folks at google here.

Be warned - this feature is experimental and unsupported.


Update- current syntax is android.jetifier.ignorelist={your.ignored.lib} as Suggested by @YaMiN

3
  • 1
    This works for me and says "WARNING: The option setting 'android.jetifier.blacklist=pass' is experimental and unsupported.". Thanks. Aug 8, 2019 at 17:23
  • This does absolutely nothing. Aug 19, 2021 at 18:22
  • Any equivalent options for Xamarin android?
    – Suchith
    Dec 14, 2021 at 7:27
4

Currently android.jetifier.blacklist is deprecated.

It was removed in version 7.0 of the Android Gradle plugin. This property has been replaced by android.jetifier.ignorelist

2

If you need to ignore just a specific .jar file from the jetifier. You can add the file name in the gradle.properties like on the last line from this example.

android.useAndroidX=true
android.enableJetifier=true
android.jetifier.blacklist=liblinphone-4.0.1-debug-symbols.jar
2

Add this in project's gradle.properties: android.jetifier.blacklist =xx.aar,yy.jar split the black list with comma

update on 2022/06/07

If you use gradle 7, it change to android.jetifier.ignorelist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.