John Gilmore
John Gilmore

Reputation: 456

Android studio gets error on fresh flutter app

When I try to run my flutter app from inside android studio I get the following output:

/home/jgilmore/src/dart-sdk/bin/dart --enable-asserts --enable-vm-service:34139 /home/jgilmore/src/fht_tool/lib/main.dart
Observatory listening on http://127.0.0.1:34139/

lib/main.dart:1: Warning: Interpreting this as package URI, 'package:fht_tool/main.dart'.
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/dialog.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui';
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/input_border.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/input_decorator.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/mergeable_material.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/shadows.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color, Offset;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/slider_theme.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Path;
       ^

Process finished with exit code 254

Ok, so that doesn't work. But if I run "flutter run" from the command line, the app loads.

Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       0.9s
Resolving dependencies...                                    8.9s
Gradle task 'assembleDebug'...                                   
Gradle task 'assembleDebug'... Done                         22.4s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                  0.2s
Error: ADB exited with exit code 255
[  0%] /data/local/tmp/app.apk
[...snip...]
[ 66%] /data/local/tmp/app.apk
adb: error: failed to copy '/home/jgilmore/src/fht_tool/build/app/outputs/apk/app.apk' to '/data/local/tmp/app.apk': remote No space left on device
/home/jgilmore/src/fht_tool/build/app/outputs/apk/app.apk: 0 files pushed. 110.9 MB/s (17561504 bytes in 0.151s)
Uninstalling old version..

I'm thinking the error complaining about "remote: no space left on device" may have something to do with it. I've certainly had no luck searching for the errors that android studio is throwing when it tries to build. But as far as I can tell, neither my computer's root drive, nor the android device, are out of space? And if that's the case, WHY DOES IT STILL WORK? And how do I get it to work inside android studio?

Since I've gone through all the trouble of installing the monstrosity that is android studio, I'd like it if it actually RAN.

Please note that this is a brand-new project. I've deleted comments, but not actually changed any of the dart code yet. Maybe I generated it wrong?

Edit: I fail to see how a compile-time error could be caused by the particular runtime environment, but it's a crazy world we live in. So I wiped and reset my emulated device anyway. Same error. Just for giggles, I shut it off, plugged in my physical phone, and tried to compile it for my phone. Same thing again.

Upvotes: 7

Views: 10791

Answers (7)

Adviteeya Jamwal
Adviteeya Jamwal

Reputation: 1

For guys using VSCode.

connect your device to pc , start usb debugging instead of using run button of vscode , try using command (flutter run) . Example: The flutter app created is newapp . go the vscode terminal , enter the dirctory newapp using command (cd newapp) and run command (flutter run) in the terminal . Select the device to install app , generally we have chrome web , but you can also select your personal device to run on that .

It will install the app in your device .

Remember one thing open the correct path of flutter app , in vscode terminal.

This works for me .

Upvotes: 0

Vijay Raj
Vijay Raj

Reputation: 1

I had an Interpretion error with my code.Running the flutter doctor and surfing the web didn't resolve.just upgrading my flutter sdk from 2.5.2 to 2.5.3 resolved my issue.

Upvotes: 0

neronovs
neronovs

Reputation: 526

The answer was already done, I want to visualize it. As @Edi has already mentioned, you need:

  1. To go to Edit Configuration in the Run tab Edit configuration
  2. To add a new entry the ( + ) plus sign to add a new configuration Add new config
  3. To tap flutter and select path to the package you're using in this case main.dart. Select Flutter
  4. Save and run this main.dart that you created. Run it

Upvotes: 0

Pradhikshen N
Pradhikshen N

Reputation: 1

check doing with these both:

  1. Uninstall any previous app of either of flutter or any other and then run, usually the specifications(storage) of the phone maybe low to install lot of apps.

  2. check if you are creating your project in the same directory as used first. change in location may show errors in code editors(doesn't happen when you run in command prompt).

I was able to install only one flutter app at a time.

Upvotes: 0

nishant
nishant

Reputation: 11

i faced same issue

lib/main.dart:1: Warning: Interpreting this as package URI, 'package:fht_tool/main.dart'.
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///home/jgilmore/src/flutter/packages/flutter/lib/src/material/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
  

it solved my problem by File>New>Project Version Control . Loging in into Git account and creating repositories ,

Upvotes: 0

Edi
Edi

Reputation: 2301

Another way to solve this is to go to Edit Configuration in the Run tab, then add a new entry the ( + ) plus sign to add a new configuration, then tap flutter and select path to the package you're using in this case main.dart. Save and run this main.dart that you created.

Upvotes: 4

Mr. N
Mr. N

Reputation: 374

You've probably run the dart file with the dart icon instead of the Flutter icon.

The one on the bottom

You can access this menu from the Run dropdown menu in android studio's toolbar.

Upvotes: 27

Related Questions