Hi,
I recently switched to Fedora Silverblue. I configured everything and my Desktop is working great so far .
I now have to develop a Flutter app for a study project.
alexl lists here three possibilities to accomplish it.
The first option is not possible due to needed changes in Android Studio or Visual Studio Code. Probably through a extension vscode could be enhanced to support containerized workflow for mobile app development.
The second option would require flatpak sdk extensions for Android, Flutter and Java.
Right now there arenāt flatpak sdk extensions available for Android and Flutter. As I have not enough knowledge to build suchs flatpaks and it would require me to invest much time which I donāt have right now, this isnāt an option. Though the Java sdk extension should be useful.
I installed org.freedesktop.Sdk.Extension.openjdk11/x86_64/18.08 from flathub. So from the terminal in vscode I can navigate to /usr/lib/openjdk11/. There is a script to enable it:
The third option is command invocation through flatpak-spawn --host. This seems for me the easiest approach. I downloaded the flutter sdk, set up my PATH variable and voila flatpak-spawn --host flutter doctor is detecting the flutter binary.
bash-4.4$ flatpak-spawn --host flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[ā] Flutter (Channel stable, v1.0.0, on Linux, locale de_DE.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
ā No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and the java
binary in your PATH. You can download the JDK from
https://www.oracle.com/technetwork/java/javase/downloads/.
[!] Android Studio (not installed)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Because this trial and error approach is taking quite some time I thought maybe someone else has already setup his flutter development environment.
So can anyone help me to set up a flutter development environment with Android Studio or Visual Studio Code?
I have a working but terribly ugly Flutter Flatpak manifest I can upload later today. You need Android Studio installed + have already downloaded the SDK through Studio for it to work, and itās absolutely terrible from a cleanliness standpoint, but hey, it worksā¦ ĀÆ\_(ć)_/ĀÆ
Iāve experimenting with an approach for IDEās under Silverblue. The basic idea is that fedora-toolbox exports a magic filesystem $HOME/.local/share/fedora-toobox/env/_default/exe where running binaries actually runs them inside the toolbox. (Executing a binary actually executes a shell script that use flatpak-spawn or podman exec.) Then you can point PATH, JAVA_HOME, etc, to that directory. Iāve tested that the basics work for Java inside of vscode with this approach.
Itās highly experimental - even if you can get it working, itās probably going to take hours of fiddling, but if you want to try it out, basic instructions would look like:
Inside your fedora-toolbox environment:
Install whatever dependencies you need for your envvironment
In user settings, set java.home to <your $HOME>/.local/share/fedora-toolbox/env/_default_/exe/usr/lib/jvm/java-11-openjdk-11.0.1.13-4.fc29.x86_64/" (or whatever JAVA_HOME you need)
Optional: set: terminal.integrated.shell.linux to <your home>/.local/share/fedora-toolbox/env/_default/exe/usr/bin/bash (this is convenient when you are programming, but not so good for debugging what is going wrong with the setup.)
If you can get that working, congratulations! The eventual idea:
Make this a standard part of fedora-toolbox, make launching toolboxd automatic
Get support for this integrated into IDEās or upstream at least the Flatpak packaged versions
Support multiple toolboxes, allow someone to provide a Dockerfile/image for āFlutter developmentā toolbox
So you just run āfedora-toolbox create --type=Flutterā, then in vscode workspace settings, select the Flutter toolbox. Thatās the dream anyways
I guess you mean the Android Studio zip file from Google.
Because I installed Android Studio from flathub and let the wizard download the usual stuff (Android SDK + Emulator). But itās not possible to build an apk within studio with this version.
10 mins later ā¦
Wait. Iām so silly . If you just use the Android Studio zip file distributed by Google everything is working fine. I was so excited about flatpak that I didnāt considered that .
Nevertheless Iām still interested in a flatpak solution .
Hello @smartens,
I have been struggling for the most part with using IDEās in flatpak form. That is until recently anyway. I do some java development in my day to day life. I like to use IntelliJās IDEA CE ide, but when I started out using Silverblue around F28, there really were no visible options as a flatpak, and fedora-toolbox hadnāt come along, so I first went to what I know, the rpm repoās and tried rpm-ostree layering. This is a mixed result that deviates greatly from both the intent of the OS core ideas, with respect to the isolation of applications from one another and the host, plus it doesnāt actually facilitate workflow on your PC as well as it would have been if the PC was just a F29 workstation setup as per normal, letās call it legacy. So flatpaks keep coming and one day Netbeans appears and it is working fine for openjdk 10, but not 11 or 9 or 8 even, and I still really wanted IDEA. Within days, there was an IDEA flatpak, and I installed it excitedly, only to crash to disappointment again as I was faced with not being able to use my layered JDK11! I decided to āhelpā the people who flatpakād IDEA and modified their original manifest and built a fully working flatpak with openjdk10 and 11 and 9 as sdk extensions, man was I stoked now! I committed it and issued a PR, then was duly informed my changes werenāt necessary. All I had to do was install the extensions for openjdk 9, 10 and 11 and IDEA and NB both can see them. I can build java apps in both and compile them then run them in the ide or in my fedora-toolbox container. Openjdk 9 extension is not working it seems.