log在flutter应用程序的发布模式下,使用方法from打印的控制台日志dart:developer是否可见?从发布模式的文档中我们可以读到
调试信息被删除。调试已禁用。
我认为它会删除用debugPrintmethod 打印的所有内容,但我找不到有关logmethod的任何内容。
方法的输出也一样吗print?这些打印对于正在阅读设备日志输出的用户是否可见?Dart linter仅表示在生产代码中应避免打印,我认为是因为打印输出可见性。
flutter 文档中有关日志记录的章节介绍了如何使用它们,但没有真正回答上面的问题。
背景
\n我刚刚为 Windows 机器开发了第一个 Flutter 桌面应用程序。该应用程序在开发/调试时工作正常,但我正在尝试将其作为发布模式下的应用程序进行测试。
\n\xe2\x80\x99s 做了什么
\n实际问题
\n当我在其他系统上安装应用程序时(甚至在我调试应用程序的实际系统上)。我可以成功安装 msix 安装程序,我可以看到应用程序中列出了我的应用程序,但是当我尝试打开它时,它卡在空白/白色屏幕上。没有呈现 UI。如果我尝试最大化窗口,它会进入应用程序无响应状态。\n任何帮助将非常感激。\n提前致谢。
\n更新/新发现
\n在浏览了Yehuda Kremer提供的链接并揪着我的头发几天后,我在这条推文中找到了答案\n https://twitter.com/FilledStacks/status/1436280577439715338?s=20
\n所以主要问题是应用程序使用了一些在其他机器上不起作用的绝对路径(发布后)
\n1- 我的应用程序正在使用数据库,因此我确保该数据库路径是相对于应用程序文档目录的。\n2- 现在构建还引用了一些依赖项,并且它们的路径也是绝对的。我注意到CMAKE_INSTALL_LOCAL_ONLY其中有一个标志cmake_install.cmake,但该标志没有在任何地方设置。
flutter build windows -v这是\n https://pastebin.com/LAeshUMY的日志
-- 现在我正在寻找一种正确的方法将所有路径转换为相对路径,以便构建可以安装在不同的计算机上,而不仅仅是本地安装。
\n我尝试将 AAB 文件上传到播放控制台,但为上传的 APK 或 Android 应用程序包提供了一个带有意图过滤器的活动、活动别名、服务或广播接收器,但没有设置“ ”android:exported属性。此文件无法安装在 Android 12 或更高版本上。请参阅:developer.android.com/about/versions/12/behavior-changes-12#exported 错误。我exported= true也将属性设置为活动。并且还要添加android:exported="true" tools:node="merge".
我根据建议对清单进行了更改,然后也遇到了同样的问题。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.example">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:label="Demo"
android:icon="@mipmap/ic_launcher_foreground">
<activity
android:name=".MainActivity"
android:launchMode="singleTop" …Run Code Online (Sandbox Code Playgroud) android android-studio flutter google-play-console flutter-release
我已经发布了带有签名密钥的 apk,但它没有安装在 android 设备上,它显示此消息“ apk 无法安装错误:无法解析错误字符串”但调试模式 apk,该应用程序工作正常。
释放命令
颤振构建 apk --release。
我确实按照这个问题来解决它,希望它可以帮助某人。
我最近添加的 quick_actions 插件在调试模式下工作正常,但在发布模式下显示空白屏幕。
在日志中发现了这些问题。
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getLaunchAction on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
<asynchronous suspension>
#1 QuickActions.initialize (package:quick_actions/quick_actions.dart:68)
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method setShortcutItems on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
Run Code Online (Sandbox Code Playgroud)