DockerFlutter icon indicating copy to clipboard operation
DockerFlutter copied to clipboard

Connecting to a device (iPhone or Android)

Open AmirNaghibi opened this issue 4 years ago • 3 comments

Great project! I'm using your image and am able to create an app inside a flutter container.

Any tips on how to connect to a device? I have connected my iPad but after running flutter run I get an error:

No supported devices connected.

Is there any argument I need to pass when running a container? Currently I'm using the following command:

docker run --rm -it -h ubuntu -v $PWD:/software --name flutter -p 8080:8080 fischerscode/flutter /bin/bash

AmirNaghibi avatar Jan 03 '22 17:01 AmirNaghibi

This is what I see after running flutter doctor :

Screen Shot 2022-01-03 at 9 24 09 AM

I believe I need to install Android SDK and probably XCode for iPhone? 🤔

AmirNaghibi avatar Jan 03 '22 17:01 AmirNaghibi

Never tried this since I am only using the image to build a flutter web application.

Connecting the device to the container could be done using --device.

I assume it's pretty hard to run on an iPhone since it would require xCode to build the application. Running on android might be possible by installing android studio.

fischerscode avatar Jan 03 '22 20:01 fischerscode

Mainly for documenting progress

By doing the following it, it is possible to build an apk using this image. docker run --rm -ti fischerscode/flutter-sudo:stable

sudo apt-get update
sudo apt-get install -y libcanberra-gtk-module android-sdk software-properties-common
curl -o commandlinetools-linux.zip https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip #link from https://developer.android.com/studio#command-tools
sudo mkdir -p /usr/lib/android-sdk/cmdline-tools
sudo unzip -d /usr/lib/android-sdk/cmdline-tools commandlinetools-linux.zip
sudo mv /usr/lib/android-sdk/cmdline-tools/cmdline-tools /usr/lib/android-sdk/cmdline-tools/latest

sudo /usr/lib/android-sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-29" "build-tools;32.0.0"
flutter create test
cd test
sudo /home/flutter/flutter-sdk/bin/flutter build apk

fischerscode avatar Jan 03 '22 21:01 fischerscode