我的 flutter 应用程序未安装在 Android 12 版本上。我尝试过android:exported,但没有任何效果。它向我展示了这种类型的错误-
\xe2\x9c\x93 Built build/app/outputs/flutter-apk/app-debug.apk.\nInstalling build/app/outputs/flutter-apk/app.apk... 3.3s\nError: ADB exited with exit code 1\nPerforming Streamed Install\n\nadb: failed to install /Users/abir/Documents/Office\nWork/MediMate-App-Old-Version/build/app/outputs/flutter-apk/app.apk: Failure\n[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:\n/data/app/vmdl489268217.tmp/base.apk (at Binary XML file line #125):\nio.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+ (version 31 and above)\nrequires that an explicit value for android:exported be defined when intent filters are present]\nError launching application on sdk gphone64 x86 64.\nRun Code Online (Sandbox Code Playgroud)\n这是我的AndroidManifest.xml文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"\n package="care.example.health">\n <uses-permission android:name="android.permission.READ_PHONE_STATE"/>\n <uses-permission android:name="android.permission.INTERNET" />\n <uses-permission android:name="android.permission.RECORD_AUDIO" />\n <uses-permission …Run Code Online (Sandbox Code Playgroud) 我想通过多部分文件请求上传图像。使用此代码当我传递两个图像文件时,它工作正常。但是,当我想传递一个图像文件而另一个图像文件为空时,它就不起作用。哪里有问题?我该如何解决这个问题?
这是我的代码 -
Future<Map<String, dynamic>> updateprofile(
UpdateProfileInfo updateProfileInfo,
File imageFile,
File signatureFile) async {
String url = "$baseAPIUrl/update-profile-info";
String _token = await SavedData().loadToken();
String authorization = "Bearer $_token";
final headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
"Authorization": authorization
};
var request = http.MultipartRequest("POST", Uri.parse(url));
request.headers.addAll(headers);
request.fields.addAll(updateProfileInfo.toJson());
request.files
.add(await http.MultipartFile.fromPath('image', imageFile.path));
request.files.add(
await http.MultipartFile.fromPath('signature', signatureFile.path));
print(" Update Profile Json ${updateProfileInfo.toJson()}");
print("Request Fields ${request.fields}");
http.StreamedResponse response = await request.send();
String respStr = await response.stream.bytesToString();
dynamic respJson;
try {
respJson = jsonDecode(respStr);
} …Run Code Online (Sandbox Code Playgroud) Flutter 虚拟应用程序会产生问题。
我创建了一个新应用程序并在 Android 真实设备上运行它。它在终端上不断地向我展示一个问题,例如
Performing hot restart...
Restarted application in 1,415ms.
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get binder for service "vendor.vpsservice"
E/VpsExtension( 3820): Failed to get …Run Code Online (Sandbox Code Playgroud) 当我使用 GetX 状态管理时,Flutter 默认本地化不起作用。它向我显示一个错误,例如
Undefined name 'AppLocalizations'.
Try correcting the name to one that is defined, or defining the name.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
localization flutter flutter-getx flutter-localizations applocalizations
在 iOS 上添加 firebase 依赖项后,当我想运行时,出现此错误
\nXcode's output:\n\xe2\x86\xb3\n ../ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module\n 'firebase_analytics' not found\n @import firebase_analytics;\n ~~~~~~~^~~~~~~~~~~~~~~~~~\n 1 error generated.\n note: Using new build system\n note: Building targets in parallel\n note: Planning build\n note: Constructing build description\n\nCould not build the precompiled application for the device.\n\nError launching application on Abir's iPhone.\nRun Code Online (Sandbox Code Playgroud)\n我已经尝试了很多方法。如删除 pod 文件、pod 更新、pod 安装等。
\n该项目于今年一月前完美建成。但现在它告诉我错误。首先他们向我显示位置 16+ 错误。然后我将位置包更改为地理定位器。但不固定。然后创建新项目并导入旧代码库。并且还将 target 和compilesdk 更改为 31。并取消注释compileOptions
这是我的应用程序级别 build.gradle-
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply …Run Code Online (Sandbox Code Playgroud) 我用于setState(() {})为变量赋值。但它一次又一次地打印。为什么会有这样的反应?我该如何解决?
这是我的代码:
class Sample extends StatefulWidget {
@override
_SampleState createState() => _SampleState();
}
class _SampleState extends State<Sample> {
String _message;
String _appLink;
Firestore db = Firestore.instance;
@override
Widget build(BuildContext context) {
db.collection('share').document('0').get().then((value) {
var message = value.data['message'];
print(message);
var appLink = value.data['appLink'];
setState(() {
_message = message;
_appLink = appLink;
});
});
return Container(
child: Text('$_message $_appLink'),
);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的输出:
这里的_appLink价值是www.facebook.com
我想通过单击 AppBar 的 来隐藏我的图像容器IconButton。但我的 AppBarIconButton不起作用。 我想,我的代码犯了一个错误......
import 'package:flutter/material.dart';
import 'package:icon_shadow/icon_shadow.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
bool viewVisible = true;
/* void showWidget() {
setState(() {
viewVisible = true;
});
print("Pressed");
}
*/
void hideWidget() {
setState(() {
viewVisible = false;
print("Work");
});
}
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text("Icon & Image Shadow Demo"),
actions: <Widget>[
IconButton(
icon: …Run Code Online (Sandbox Code Playgroud) 我想运行一个现有的项目。它完全在 Android 12 下运行,但是当我要运行 Android 12 版本的三星手机时。然后我收到此类错误。
\n错误 :
\n\xe2\x9c\x93 Built build/app/outputs/flutter-apk/app-release.apk (104.1MB).\nInstalling build/app/outputs/flutter-apk/app.apk... 3.3s\nError: ADB exited with exit code 1\nPerforming Streamed Install\n\nadb: failed to install /Users/abir/Documents/Office\nWork/appName-App-Old-Version/build/app/outputs/flutter-apk/app.apk: Failure\n[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:\n/data/app/vmdl2043233695.tmp/base.apk (at Binary XML file line #124):\nio.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+\n(version 31 and above) requires that an explicit value for android:exported be\ndefined when intent filters are present]\nError running application on SM G781B.\nRun Code Online (Sandbox Code Playgroud)\n这是我的AndroidManifest.xml文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"\n package="care.appname.health">\n <uses-permission android:name="android.permission.READ_PHONE_STATE"/>\n <uses-permission android:name="android.permission.INTERNET" />\n <uses-permission android:name="android.permission.RECORD_AUDIO" />\n <uses-permission …Run Code Online (Sandbox Code Playgroud) 我在我的 flutter 应用程序上使用Getxpackage。我想更新一个双精度值。但它告诉我一个错误。
这是我的 gextController
class CustomWebViewCTRL extends GetxController {
RxDouble progress = 0.0.obs;
onProgress(pro) {
progress = (pro / 100);
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试在主屏幕上调用Obx(()=>)它GetBuilder。没有人为我工作。它说的是——
“参数类型‘RxDouble’不能分配给参数类型‘double’?”
这是一个示例(我想使用的地方):
GetBuilder<CustomWebViewCTRL>(builder: (controller) {
return LinearProgressIndicator(
value: controller.progress,
color: Colors.black,
backgroundColor: Colors.amber,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.green),
);
}),
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
flutter ×11
android-12 ×2
flutter-getx ×2
api ×1
arguments ×1
dart ×1
double ×1
fatal-error ×1
firebase ×1
geolocator ×1
http ×1
ios ×1
localization ×1
migration ×1
module ×1
multipart ×1
performance ×1
setstate ×1
string.xml ×1
terminal ×1
types ×1
vendor ×1
visibility ×1