在运行Flutter应用程序时,调试控制台中打印了如下错误:
代码语言:javascript复制Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
上述错误是,将新 ns 映射到旧 ns,可以尝试删除并重新安装 SDK 平台。根本的解决方案是升级gradle。首先,打开gradle-wrapper.properties,修改gradle版本。
代码语言:javascript复制distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip
然后,再修改android/build.gradle。
代码语言:javascript复制dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
}