android - 包含对 AndroidX 和旧支持库的引用

标签 android ios flutter androidx android-jetifier

升级flutter版本到后Flutter 1.22.0-2.0.pre.78 • channel 主 我收到此警告:-

WARNING: [Processor] Library 'C:\Users....gradle\caches\modules-2\files-2.1\io.flutter\flutter_embedding_debug\1.0.0-b1d9f863db32cb1d6714cf75db4a992ee3765113\b8748b5192a2a0961f5c14f8845331ad5f2225a1\flutter_embedding_debug-1.0.0-b1d9f863db32cb1d6714cf75db4a992ee3765113.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/annotation/VisibleForTesting' Example of support library reference: 'android/support/annotation/NonNull'`


这个问题是否会在 future 引起一些严重的问题。提前致谢 :)

最佳答案

存在此警告是因为在 latest Flutter versions新创建的项目将使用 AndroidX automatically 创建.

Starting from Flutter v1.12.13, new projects created with flutter create -t <project-type> use AndroidX by default.

Projects created prior to this Flutter version must not depend on any old build artifact or old Support Library class.

In an app or module project, the file android/gradle.properties or .android/gradle.properties must contain:

android.useAndroidX=true
android.enableJetifier=true

该警告还指出:
This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
这通常是由一些未迁移的插件和 Flutter tool uses Jetifier 引起的。这将使用支持库自动将这些 Flutter 插件迁移到 AndroidX。

The Flutter tool uses Jetifier to automatically migrate Flutter plugins using the Support Library to AndroidX, so you can use the same plugins even if they haven’t been migrated to AndroidX yet.


您可以open an issue to GitHub如果您在迁移到 AndroidX 时遇到其他问题。

关于android - 包含对 AndroidX 和旧支持库的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63592197/

相关文章:

Android TableLayout 表示为 LinearLayout 的百分比

ios - Xcode 更改文件和文件夹的命名以供批准

iOS:拥有具有 Firebase 授权的用户名

flutter - 如何在开发过程中同时使用 Android 和 IOS 模拟器来测试我的 flutter 应用程序?

flutter - 使用 StatefulWidget 标记为 @immutable 的类,实例字段不是最终的

Flutter SharedPreferences 不可为 null 的实例字段

java - 我无法在 SQLite 中按 id 删除某些行

java - 如何将一种用户类型的列表复制到其他类型的列表?

Android lineHeight 与 lineSpacingExtra

ios - 我们可以在 2 个不同的配置文件中添加 iOS 设备的单个 UDID