flutter警告消除方式

1.問題

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/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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

造成該問題的原因是gradle插件版本(我的是4.1.3)和distributionUrl=*/gradle-7.0.2-all.zip這個(gè)地方的版本不一致導(dǎo)致的
解決方式
將android下build.gradle中的dependencies中修改為以下

  classpath 'com.android.tools.build:gradle:7.0.0'

緊接著出現(xiàn)了第二個(gè)問題

FAILURE: Build failed with an exception.

* Where:
Build file '/opt/homebrew/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.flutter-io.cn/jverify-2.2.1/android/build.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':jverify'.
> No signature of method: build_7zl2566gv7mxy0ulm38137lif.android() is applicable for argument types: (build_7zl2566gv7mxy0ulm38137lif$_run_closure2) values: [build_7zl2566gv7mxy0ulm38137lif$_run_closure2@fd81999]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1

解決方案 找到/opt/homebrew/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.flutter-io.cn/jverify-2.2.1/android/build.gradle 該文件所在地 執(zhí)行以下方法

注釋掉:useProguard true
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容