Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

androidX jetifier - Is there a way to ignore jetifying a .JAR?

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

like image 728
Mardann Avatar asked Apr 23 '19 14:04

Mardann


2 Answers

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

like image 117
YaMiN Avatar answered Sep 19 '22 09:09

YaMiN


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

like image 26
twlkyao Avatar answered Sep 18 '22 09:09

twlkyao