androidX jetifier - 有没有办法忽略 jetifying .JAR?
androidX jetifier - Is there a way to ignore jetifying a .JAR?
正在尝试将我的应用更新为 androidX
依赖项。按照说明 here 进行操作,但编译失败。
错误来自 JetifyTransform
任务未能处理某个 .JAR 依赖项(仅供参考 - 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.)
尝试使用 jetifier-standalone
工具进行 jetify 得到类似的结果:
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)
现在,如果 SDK 没有被jetified,我真的不介意,所以我尝试在我的 gradle.properties
文件中设置 android.enableJetifier=false
,但由于不同的原因再次编译失败- [=据报道,17=] 与 androidX 不兼容
所以我卡住了。使用 jetify .JAR 不会转换。与它 - SupportMapFarg 不兼容。
有什么建议吗?
P.S。你知道什么会很好吗?如果 jetifying 函数有 ignore
选项
将此添加到 gradle.properties
:
android.jetifier.blacklist = pass
正如 google here.
的人们所建议的那样
请注意 - 此功能是实验性的,不受支持。
更新-当前语法是android.jetifier.ignorelist={your.ignored.lib}
,由@YaMiN
建议
如果您只需要忽略 jetifier 中的特定 .jar 文件。您可以在 gradle.properties 中添加文件名,就像此示例的最后一行一样。
android.useAndroidX=true
android.enableJetifier=true
android.jetifier.blacklist=liblinphone-4.0.1-debug-symbols.jar
在项目 gradle.properties 中添加:
android.jetifier.blacklist =xx.aar,yy.jar
用逗号分割黑名单
目前 android.jetifier.blacklist
已弃用。
它已在 Android Gradle 插件的 7.0 版中删除。
此 属性 已替换为 android.jetifier.ignorelist
正在尝试将我的应用更新为 androidX
依赖项。按照说明 here 进行操作,但编译失败。
错误来自 JetifyTransform
任务未能处理某个 .JAR 依赖项(仅供参考 - 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.)
尝试使用 jetifier-standalone
工具进行 jetify 得到类似的结果:
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)
现在,如果 SDK 没有被jetified,我真的不介意,所以我尝试在我的 gradle.properties
文件中设置 android.enableJetifier=false
,但由于不同的原因再次编译失败- [=据报道,17=] 与 androidX 不兼容
所以我卡住了。使用 jetify .JAR 不会转换。与它 - SupportMapFarg 不兼容。
有什么建议吗?
P.S。你知道什么会很好吗?如果 jetifying 函数有 ignore
选项
将此添加到 gradle.properties
:
android.jetifier.blacklist = pass
正如 google here.
的人们所建议的那样请注意 - 此功能是实验性的,不受支持。
更新-当前语法是android.jetifier.ignorelist={your.ignored.lib}
,由@YaMiN
如果您只需要忽略 jetifier 中的特定 .jar 文件。您可以在 gradle.properties 中添加文件名,就像此示例的最后一行一样。
android.useAndroidX=true
android.enableJetifier=true
android.jetifier.blacklist=liblinphone-4.0.1-debug-symbols.jar
在项目 gradle.properties 中添加:
android.jetifier.blacklist =xx.aar,yy.jar
用逗号分割黑名单
目前 android.jetifier.blacklist
已弃用。
它已在 Android Gradle 插件的 7.0 版中删除。
此 属性 已替换为 android.jetifier.ignorelist