我正在尝试将代码运行到Flutter应用中!
我尝试运行main.dart
,但是当我运行代码时,它在模拟器上不起作用
这是我的代码:
import 'package:flutter/material.dart';
void main() =>
runApp(MaterialApp(
home : NinjaCard () ,
));
class NinjaCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold (
appBar: AppBar (
title : Text(' Ninja Card Id ') ,
),
);
}
}
I try to run my code on Android Studio emulator and I get this error:
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
cmd: Can't find service: activity
Installing build\app\outputs\apk\app.apk...
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install D:\apps\firas_id\build\app\outputs\apk\app.apk: cmd: Can't find service: package
Error launching application on sdk gphone x86 arm.
Does anyone know how to fix it? Thank you in advance.
答案 0 :(得分:0)
方法1:
方法2:
打开AVD Manager
按对应于您的小箭头(在笔旁边) 首选设备
选择“立即冷启动”
等待仿真器打开并启动
运行您的应用程序