cvsouth
Posts: 1
Joined: Thu Jul 22, 2021 7:35 am

Android Development on a Raspberry Pi

Thu Jul 22, 2021 7:46 am

I'm creating an ultra portable app development setup with a Raspberry Pi 4 8GB, and my phone or tablet as a display.

This is the RPI with a HDMI to USB-C cable. I can plug this into my phone or tablet and use this app to turn the handset into a display:

Image

Since Android Studio is not compatible with ARM I have installed VS Code and installing the Android SDK manually. This is how it looks using VS Code with my phone as the display. Pretty nice:

Image

I've made some progress towards Android/Flutter development set up, here's what I have so far:

  • Installed Ubuntu to the Raspberry Pi
  • Installed Flutter 2.4 using snap
  • Installed Chromium and pointed CHROME_EXECUTABLE to it in .bashrc
  • Installed VS Code with Dart and Flutter plugins
  • Installed the Android SDK using apt install android-sdk
  • Installed the Android Command Line Tools from here and added them to my PATH
  • Installed platform-tools, platforms;android-28 and build-tools;28.0.3 using sdkmanager --install
  • Agreed to Android licenses using flutter doctor --android-licenses
But here is the issue. When I plug my phone in (previously used for debugging with my laptop running Android Studio), flutter devices doesn't detect it, it only shows Chrome as a device. In VS Code when I go to debug, I therefore only get Chrome as an option, which incidentally does work fine for web debugging. My phone has "USB debugging is on" on the handset.

A few things I noticed are:

  • Despite installing the command line tools, they are completely ommited from flutter doctor (see output below). As far as I can tell they are installed but I am not sure if I need to add something to my .bashrc?
  • If I enter which adb into terminal I get /usr/bin/adb rather than /usr/lib/android-sdk/platform-tools/adb. Both seem to work and this is the output of adb devices:

Code: Select all

List of devices attached
6369e875	device
  • I tried setting up an emulator but emulator isn't available as a package from sdkmanager and VS Code says avdmanager is missing from the Android SDK when try to create one through there. I didn't pursue this since I expect that would be a bit heavy for the pi anyway so rather debug on my actual device. I just presume that the emulator doesn't supprt ARM or something.
Here is the output of flutter doctor -v

Code: Select all

[✓] Flutter (Channel master, 2.4.0-5.0.pre.122, on Ubuntu 21.04 5.11.0-1012-raspi, locale en_GB.UTF-8)
    • Flutter version 2.4.0-5.0.pre.122 at /home/user/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5acf7e98f1 (17 hours ago), 2021-07-20 19:58:58 -0700
    • Engine revision 9b270621e4
    • Dart version 2.14.0 (build 2.14.0-338.0.dev)
[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /snap/bin/chromium
[✓] VS Code (version 1.58.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.24.0
[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Chromium 91.0.4472.164 snap
• No issues found!

I'm two days into this problem already and I've learned a lot but I'm reaching the point now where I'm a little stuck so any help is greatly appriciated, and hopefully what I've done so far can help someone in the future

To be clear the problem I'm facing is that my device doesn't appear in flutter devices and I can't debug with it in VS Code
Last edited by cvsouth on Thu Jul 22, 2021 11:30 am, edited 1 time in total.

Return to “Other projects”