Flutter 打包apk报错:FAILURE: Build failed with an exception. * What went wrong: A problem occurred conf
Flutter打包apk报错:FAILURE: Build failed with an exception. 的解决办法
作者:任聪聪
日期:2024年12月28日
报文信息:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':connectivity_plus'. > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace. If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant. * 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 Running Gradle task 'assembleRelease'... 3.0s Gradle task assembleRelease failed with exit code 1
问题原因:
可以看到报错信息为connectivity_plus 的命名空间问题导致,这里我们flutter的安卓项目下的gradle实际上是不用改的。故此这个报错肯定是版本过低的bug或者其他原因导致。
解决办法:
说明:升级我们的connectivity_plus 这个包的版本以此修复这个问题。
修复后尝试打包,输出结果正常:
免责声明:我们致力于保护作者版权,注重分享,被刊用文章因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理! 图片声明:本站部分配图来自人工智能系统AI生成,觅知网授权图片,PxHere摄影无版权图库和百度,360,搜狗等多加搜索引擎自动关键词搜索配图,如有侵权的图片,请第一时间联系我们。