Yes, I can. (古る!)
ちょっと難儀しましたが、動かせましたのでご報告。以前記事にしたようにAndroid studioは動かなかったので、FlutterでLinuxアプリまでなら作成可能か試してみました。
導入環境
毎度の事、私のChromebookはコレ一台のみ
[rakuten:b-surprise2:10098177:detail]
項目 | 内容 |
---|---|
メーカー | acer |
機種 | Spin 311 |
CPU | MediaTek M8183C 2.0GHz |
メモリ | 4GB |
ストレージ | eMMC 32GB |
アーキテクチャはarm。
これまで色々いじくり回した挙げ句、整理整頓してこなかったLinux環境は、お陰様で容量カツカツ。一度全部消してみました。
ここから再度Linux環境を立ち上げました。本当にゼロからスタートします。
VScodeをインストール
若干手こずってしまったのがココ。公式サイトからインストーラーをダウンロードしてダブルクリックするだけで事足りるハズ…
確か前はここからダウンロードしたはず。「.deb」をクリニックし、ダウンロードし、いざダブルクリックしてみると「この環境にはインストールできない」旨のメッセージが…
は?なんで?前はなんの支障もなかったような?
理由は単純で、何故かamdアーキテクチャ用のインストーラーが自動選定されてダウンロードされるっぽい(私のChromebookがイケてないんだろう)です。
なので、キチンとarm64用をダウンロードすれば支障無くインストールできました。
Flutter環境構築
私のChromebookではAndroidstudioが上手く動かないことは実証済なので、Androidアプリ開発は諦めてLinuxアプリ開発ができること、を目指しました。
基本的には以下のサイトの手順通りです。
まずはFlutterを動かすためのコンパイラ等をインストールします。
Install the core development tools needed for Flutter. This downloads the compiler toolchain needed to compile apps for ChromeOS.
sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev
つぎはFlutter本体をGitHubから持ってきます。
Download Flutter from the Flutter repo on GitHub with the following command in your home directory.
git clone https://github.com/flutter/flutter.git -b stable
で、パスの設定
Add the flutter tool to your path.
echo PATH="$PATH:`pwd`/flutter/bin" >> ~/.profile source ~/.profile
You are now ready to run Flutter commands. Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the -v flag)
つぎはこのコマンドを実行。
flutter doctor
This command checks your environment and displays a report to the terminal window. The Dart SDK is bundled with Flutter; it is not necessary to install Dart separately. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
ここからはChromeOS特有の事象。普通のLinuxならここまでで完了するらしいが、ChromeOSでは、Linux環境がコンテナ内にあるということと、ブラウザであるChromeがOSに一体化してしまっている(?多分表現がおかしい)ので、このままだと上手く行かない。らしい。
On ChromeOS, you do development work in a Linux container. However, the Chrome browser itself is part of the parent ChromeOS operating system, and Flutter doesn’t have a means to call it with the required parameters. Track this issue at Issue 121462: Improve the web debugging experience on Chromebooks. Instead, the best approach is to manually install a second copy of Chrome in the Linux container. You can do that with the following steps:
よって以下を実行することが解決策だ、と参考サイトに記載されている。
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install ./google-chrome-stable_current_amd64.deb
しかし、ここで詰んでしまいます。VScodeインストールのときと同じく、私のChromebookはarmアーキテクチャであるのに対して、上記でやろうとしているのはamdアーキテクチャ用のインストーラーを導入することで、当然上手く行かない。
厄介なことにarm用のdebファイルは見つけられなかった。
じゃあどうする?公式サイトにはこれ以上何も書いてない。
あとできることは…Androidstudio導入をやろうとしたとき、一瞬成功したかと思ったアレを試してみる。
$ sudo dpkg --add-architecture amd64 $ sudo apt update
すると…。
VScodeからアプリ立ち上げに成功!
いやぁ~、何度も同じこと繰り返してますが、armでChromebookが一番手頃だったから購入しましたけど、開発環境の選択肢としては全くオススメできないですね。何をするにしても途中で必ず躓いて、中々本題に入れない。
私みたいな初心者は黙ってIntel入れとけってことですかね。
以上です。