首页
关于
Search
1
flutter 中web应用,在微信开发工具打开链接,报错imageCodecException
5 阅读
2
webman跨域问题
5 阅读
3
升级flutter版本,构建的时候,出现Kotlin增量编译缓存错误
1 阅读
默认分类
登录
Search
Typecho
累计撰写
3
篇文章
累计收到
0
条评论
首页
栏目
默认分类
页面
关于
搜索到
3
篇与
的结果
2026-06-10
升级flutter版本,构建的时候,出现Kotlin增量编译缓存错误
报错信息: What went wrong: Execution failed for task ':shared_preferences_android:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.btapi.BuildToolsApiCompilationWork > java.lang.Exception: Could not close incremental caches in D:\projects\flutterprojects\peafowlpd\build\shared_preferences_android\kotlin\compileDebugKotlin\cacheable\caches-jvm\jvm\kotlin: class-fq-name-to-source.tab, source-to-classes.tab, internal-name-to-source.tab 解决方案:在app/gradle.properties关闭增量编译缓存`android.nonFinalResIds=falseandroid.enableBuildCache=falseorg.gradle.caching=falsekotlin.incremental=false`
2026年06月10日
1 阅读
0 评论
0 点赞
2025-10-28
webman跨域问题
接口等跨域访问增加中间件如下:use Webman\Http\Response; use Webman\Http\Request; use Webman\MiddlewareInterface; class CrossDomain implements MiddlewareInterface { public function process(Request $request, callable $handler): Response { $response = $request->method() == 'OPTIONS' ? response('') : $handler($request); // 给响应添加跨域相关的http头 $response->withHeaders([ 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Origin' => $request->header('origin', '*'), 'Access-Control-Allow-Methods' => $request->header('access-control-request-method', '*'), 'Access-Control-Allow-Headers' => $request->header('access-control-request-headers', '*'), ]); return $response; } }并在config/middleware.php中修改:return [ '' => [ CrossDomain::class ], ];如果是资源类跨域问题,需要注意就是,官方的后台管理插件和webman需要分别设置跨域中间件:class StaticFile implements MiddlewareInterface { public function process(Request $request, callable $handler): Response { // Access to files beginning with. Is prohibited if (strpos($request->path(), '/.') !== false) { return response('<h1>403 forbidden</h1>', 403); } /** @var Response $response */ $response = $handler($request); // Add cross domain HTTP header $response->withHeaders([ 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Credentials' => 'true', ]); return $response; } }webman在static.php中设置,webman的管理后台插件,需要在插件中的static.php设置,设置如下:return [ 'enable' => true, 'middleware' => [ // Static file Middleware StaticFile::class, ], ];
2025年10月28日
5 阅读
0 评论
0 点赞
2025-10-28
flutter 中web应用,在微信开发工具打开链接,报错imageCodecException
报错如下:imageCodecException: Failed to decode image using the browser's ImageDecoder API.Image source: encoded image bytesOriginal browser eror: Expected a value of type'JSObject,but gotene of type'Null'原因分析:这个错误是 Flutter Web 在微信开发者工具中遇到的图像解码问题解决方法:修改 Flutter Web 渲染设置在 web/index.html 中添加以下配置:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My Flutter App</title> <!-- 添加以下 meta 标签 --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <!-- 禁用某些浏览器特性 --> <script> window.flutterWebRenderer = "html"; // 强制使用 HTML 渲染器 </script> <script src="main.dart.js" type="application/javascript"></script> </head> <body> <script> // 图像加载错误处理 window.addEventListener('error', function(e) { if (e.target && (e.target.tagName === 'IMG' || e.target.tagName === 'IMAGE')) { console.log('Image load error:', e.target.src); e.preventDefault(); } }, true); </script> </body> </html>
2025年10月28日
5 阅读
0 评论
1 点赞