我有Unity项目,使用Mapbox,
MAPBOX包括以下支持库:支持-V4-25.1.0.AAR
该库是一个.aar文件,而不是Gradle 实现
命令
尝试构建项目时,我会收到此错误:
无法确定任务的依赖性':启动器:lintvitalrease'。
无法解决配置的所有工件':启动器:debugruntimeclasspath'。
无法转换支持-v4-25.1.0-.aar(:support-v4-25.1.0 :)匹配属性{artifacttype = android-manifest,org.gradle.status = Integration = Integration}。
> JetifyTransform的执行失败:
c:\ users \ efgh \ documents \ github \ arex \ temp \ gradleout \ unityLibrary \ libs \ libs \ support-v4-25.1.0.aar。
>无法转换'c:\ user \ efgh \ documents \ github \ arex \ temp \ temp \ gradleout \ unityLibrary \ libs \ libs \ support-v4-25.1.0.aar'使用jetifier'
原因:模棱两可的stringjetifierexception,消息:给定的伪影包含一个带有包装参考的字符串“ android.support.v4”,无法安全地重写。使用反射(例如注释处理器)的图书馆需要手动更新以添加对Androidx的支持。
这是一个已知的例外,喷射器将无法喷射此库。
建议:
- 如果您认为此库不需要被喷射(例如,如果它已经支持Androidx,或者根本不使用支持库/Androidx),请添加android.jetifier.blacklist = {comma---您不想被喷射到gradle.properties文件的库的正则列表(或简单的名称)的分开。
- 如果您认为此库需要喷射(例如,如果它使用旧支持库并在您的应用程序未喷射的情况下打破您的应用程序),请联系库的作者更新此库以支持Androidx并在使用后使用支持的版本发行。
如果您需要进一步的帮助,请在。
gradle。
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
unityStreamingAssets=.unity3d**STREAMING_ASSETS**
**ADDITIONAL_PROPERTIES**
我的
此外,首先:为什么某些库不需要喷射?何时支持库支持Androidx何时不需要喷射? Jet不使用其相应的Androidx等效液体自动替换支持库的行为吗?支持库如何从喷射中获得免费通行证?这对我来说没有意义。
I have project in unity, that uses Mapbox,
Mapbox includes the following support library: support-v4-25.1.0.aar
This library comes as an .aar file and NOT as a gradle implementation
command
When trying to build the project i get this error:
Could not determine the dependencies of task ':launcher:lintVitalRelease'.
Could not resolve all artifacts for configuration ':launcher:debugRuntimeClasspath'.
Failed to transform support-v4-25.1.0-.aar (:support-v4-25.1.0:) to match attributes {artifactType=android-manifest, org.gradle.status=integration}.
> Execution failed for JetifyTransform:
C:\Users\EFGH\Documents\GitHub\AREX\Temp\gradleOut\unityLibrary\libs\support-v4-25.1.0.aar.
> Failed to transform 'C:\Users\EFGH\Documents\GitHub\AREX\Temp\gradleOut\unityLibrary\libs\support-v4-25.1.0.aar' using Jetifier.
Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won't be able to jetify this library.
Suggestions:
- If you believe this library doesn't need to be jetified (e.g., if it already supports AndroidX, or if it doesn't use support libraries/AndroidX at all), add android.jetifier.blacklist = {comma-separated list of regular expressions (or simply names) of the libraries that you don't want to be jetified} to the gradle.properties file.
- If you believe this library needs to be jetified (e.g., if it uses old support libraries and breaks your app if it isn't jetified), contact the library's authors to update this library to support AndroidX and use the supported version once it is released.
If you need further help, please leave a comment at https://issuetracker.google.com/issues/140747218.
My gradle.properties:
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
unityStreamingAssets=.unity3d**STREAMING_ASSETS**
**ADDITIONAL_PROPERTIES**
I would like to know if there is a way for me to know if a specific support library already have support for AndroidX?(So it won't need to be jetified)
Furthermore to begin with: why does some libraries don't need to be jetified? What is the meaning of when a support library have support for AndroidX and don't need to be jetified? Isn't jetify the act of automatically replacing support libraries with their corresponding AndroidX equivalent libs? How can a support library even get a free pass from being jetified? It doesn't make sense to me at all..
发布评论
评论(2)
可以肯定的是,它描述了您不需要使用Jetify的罕见可能性,例如,如果它是在不使用它的类或从未使用过的课堂中进行的。除非图书馆设计师非常草率,否则这种情况是不太可能的。但是,如果仅使用您的应用程序永远不会触摸的类支持库,则可能也可以。如果您在该条件下列出黑色列表,它是否能够编译它。
很可能您很幸运,直到您可以让图书馆作者修复它,否则您可以将其库并在您的副本中修复,如果它是开源的。 Jetpack已经存在了几年。任何仍在使用旧支持库的图书馆都有很高的可能性,即已被放弃多年,因此这也是要考虑的事情。
Pretty sure it's describing rare possibilities where you wouldn't need to use jetify it, for example, if it's being done in a class that doesn't use it, or in a class that is never used. It's very unlikely that this is the case unless the library designer was very sloppy. But possibly, it might also be OK if it is only using the support library in a class that your app will never touch. Not sure if it would be able to compile if you black list it in that condition.
Most likely you are out of luck until you can get the library author to fix it, or you could fork their library and fix it in your own copy if it's open source. Jetpack has been around for several years now. Any library still using the old support library has a high likelihood that it has been abandoned for years, so that is also something to consider.
在此处添加我的答案,以防它可以帮助任何人。
喷射器对我不起作用。我收到有关复制文件已迁移到Androidx的错误消息。
但是,我认为我设法使它正常工作。
在团结中,我使用资产>外部依赖经理> Android解析器>在构建我的APK之前,请删除已解决的库。
但是,在Android Studio中,我将错误代码复制到文档中,以便我可以看到整个内容,并发现重复的引用全都在一个文件中。我无法删除文件本身,而是去了build.gradle文件,然后删除了涉及冲突脚本的行。
作为参考,我从2020.1.1到2021.3.17更新了项目,并自动迁移到Android X,仅留下一个冲突的文件。该文件是Firebase Analytics UnityPackage的一部分。
Adding my answer here in case it helps anyone.
Jetifier just didn't work for me. I was getting an error message about duplicate files after it said it had migrated to AndroidX.
However, I think I managed to get it working....for now at least.
In Unity I used Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries before building my APK.
In Android Studio however, I copied the error code into a document so I could see the whole thing and found that the duplicate references were all in a single file. I couldn't delete the file itself, instead I went to the build.gradle file and removed the line referring to the conflicting script.
For reference, I updated my project from 2020.1.1 to 2021.3.17 and it automatically migrated to Android X, leaving just the one conflicting file. This file was was part of the Firebase Analytics unitypackage.