我试图在Android中的flutter项目中将环境变量添加到运行/调试配置中,但是这个字段已经变灰了,我不知道如何以其他方式创建环境变量。有什么想法,如何添加他们,要么以这种方式,或以其他方式?
发布于 2022-10-24 13:03:15
一种不受命令的方法是编辑flutter文件(脚本文件: unix: bash,windows: bat)。请看这里
我使用的是linux,并且我有一个应用程序规模的问题(因为我使用的是hidpi屏幕),解决这个问题的最容易的方法可能是设置环境变量GDK_SCALE=2。经过一些挣扎之后,我终于编辑了我的颤振源文件如下:
#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
export GDK_SCALE=2
# ---------------------------------- NOTE ---------------------------------- #
#
# Please keep the logic in this file consistent with the logic in the
# `flutter.bat` script in the same directory to ensure that Flutter continues
# ... [content omitted] ...如果要在启动新项目时更改环境变量,请在before launch中考虑RUN confiugration选项,可以在运行当前配置之前运行其他配置。理想的运行顺序是运行delete environment variable lines配置(Shell脚本类型),在此之前执行(启动前) flutter run配置,在此之前执行(启动前) add environment variable lines配置(Shell脚本类型)。(按顺序链接的总共3个配置文件)它还应该显示颤振调试窗口,因为该选项存在于flutter run配置中。
我尝试过的其他方法:
https://stackoverflow.com/questions/72221723
复制相似问题