当前位置: 首页 > 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.dtcms.com/a/265769.html

相关文章:

  • 创客匠人视角:知识变现与创始人 IP 打造的破局之道
  • centos7源码编译安装python3
  • SSM和SpringBoot框架的关系
  • 关于微前端框架micro,子应用设置--el-primary-color失效的问题
  • FPGA从零到一实现FOC(一)之PWM模块设计
  • 火语言 RPA:突破企业自动化瓶颈,释放数字生产力​
  • Linux基本命令篇 —— zip/unzip命令
  • Apache Commons Pool中的GenericObjectPool详解
  • 华为Freebuds 6i新音效,设置后音质敲好!
  • Nginx安全配置漏洞修复实战指南
  • 百度文心智能体平台x小米应用商店:联手打造行业首个智能体与应用市场跨端分发模式
  • React 强大的表单验证库formik之集成Yup、React Hook Form库
  • 使用 Dockerfile 构建基于 .NET9 的跨平台基础镜像
  • 安卓开机自启动方案
  • Kafka生态整合深度解析:构建现代化数据架构的核心枢纽
  • Sklearn安装使用教程
  • 机器人焊接电源节气阀
  • 工程化实践——标准化Eslint、PrettierTS
  • 读书笔记:《DevOps实践指南》
  • android 网络访问拦截器的编写的几种方式
  • React 学习(3)
  • springboot 中使用 websocket
  • PHP:从入门到实践——构建高效Web应用的利器
  • 2011年英语一
  • AlpineLinux安装x11vnc服务端实现远程桌面登录
  • Zephyr RTOS 防止中断影响数据写入
  • cv610将音频chn0配置为g711a,chn1配置为 aac编码,记录
  • ARM SMMUv3故障和错误(五)
  • mac 电脑安装Homebrew来安装npm与node成功后,安装nvm的流程
  • macOS 26正式发布,全新Liquid Glass设计语言亮相