当前位置: 首页 > news >正文

Flutter 3.29+使用isar构建失败

执行命令:flutter build apk --release
报错

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!FAILURE: Build failed with an exception.                                                                                                                                    * What went wrong:                                                                                                                                                          
A problem occurred configuring project ':isar_flutter_libs'.                                                                                                                
> 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: C:\Users\17602\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\isar_flutter_libs-3.1.0+1\android\build.gradle. 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 1s                                                                                                                                                          
Running Gradle task 'assembleRelease'...                         1,292ms
Gradle task assembleRelease failed with exit code 1
  1. 然后参考:https://github.com/isar/isar/issues/1672

在\android\build.gradle.kts文件中添加以下代码

// 添加这部分代码,且当前subprojects 必须是当前文件的第一个subprojects块
subprojects {afterEvaluate {project.extensions.configure<com.android.build.gradle.BaseExtension> {if (namespace == null) namespace = project.group.toString()}}
}

再次尝试构建,发现会提示另一个错误:

FAILURE: Build failed with an exception.What went wrong:
Execution failed for task ':isar_flutter_libs:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed
ERROR:E:......\build\isar_flutter_libs\intermediates\merged_res\release\values\values.xml:194: AAPT: error: resource android:attr/lStar not found.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
  1. 最后再另一个issue里面找到了解决方案:
    https://github.com/isar/isar/issues/1681
    使用以下subprojects 区块代码,替换\android\build.gradle.kts里的所有subprojects 区块
subprojects {val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)project.layout.buildDirectory.value(newSubprojectBuildDir)
}subprojects {afterEvaluate {if (project.hasProperty("android")) {val androidExtension = project.extensions.findByName("android")if (androidExtension is com.android.build.gradle.BaseExtension) {androidExtension.compileSdkVersion = "android-35"androidExtension.buildToolsVersion = "35.0.0"androidExtension.ndkVersion = "27.0.12077973"if (androidExtension.namespace == null) {androidExtension.namespace = project.group.toString()}}}}
}subprojects {project.evaluationDependsOn(":app")
}

最后再执行构建命令就可以成功构建了

但是后来发现isar在github上已经两年多没更新了,遂切换其他本地数据库

http://www.lryc.cn/news/579486.html

相关文章:

  • HarmonyOS ArkTS卡片堆叠滑动组件实战与原理详解(含源码)
  • Java网络编程:TCP/UDP套接字通信详解
  • I/O 进程 7.2
  • 在Ubuntu 24.04主机上创建Ubuntu 14.04编译环境的完整指南
  • (一)复习(模块注入/minimal api/EF和Dapper实现CQRS)
  • Ubuntu Gnome 安装和卸载 WhiteSur-gtk-theme 类 Mac 主题的正确方法
  • Frida:配置自动补全 in VSCode
  • TCP 三次握手与四次挥手详解
  • MyBatis 之基础概念与框架原理详解
  • RabbitMQ 通过HTTP API删除队列命令
  • 【如何判断Linux系统是Ubuntu还是CentOS】
  • Centrifugo 深度解析:构建高性能实时应用的开源引擎
  • 记忆翻牌记忆力小游戏流量主微信小程序开源
  • 网创vip课程视频教程、付费网络课程以及网赚培训,学习引流、建站、赚钱。8个T的全套课程
  • 【2.3 漫画SpringSecurity - 守护应用安全的钢铁卫士】
  • ATE FT ChangeKit学习总结-20250630
  • Easy-excel监听器中对批量上传的工单做错误收集
  • Redisson使用示例
  • 请求未达服务端?iOS端HTTPS链路异常的多工具抓包排查记录
  • 【Bug Recod】更新中...
  • Day50
  • 一文详解Character AI:实用指南+ ChatGPT、Gemini对比分析
  • contenteditable网页富文本编辑无法选中图片
  • Swift 的基础设计哲学是 “通过模块化组合实现安全与效率的平衡“,就像用标准化工业零件建造摩天大楼
  • 一台香港原生ip站群服务器多少钱?
  • 如何在Ubuntu上检查MySQL是否启动并放开3306端口
  • C++笔记-位图和布隆过滤器
  • P1155 [NOIP 2008 提高组] 双栈排序
  • 李宏毅机器学习笔记——梯度下降法
  • 映射阿里云OSS(对象存储服务)