Evgenii Legotckoi
Evgenii LegotckoiJan. 6, 2019, 7:03 a.m.

Flutter - Tutorial 001. Hello world

Flutter is a fresh framework from Google for application development for Android and iOS. The programming language used is Dart (also developed by Google).

Let's understand the launch of our first application on Flutter.


To create our first application that will run under Android, you need to install all the necessary components. The installation of these components will be done in the Ubuntu Linux OS.

Download Flutter

In the official documentation, it is first proposed to download Flutter itself, and then unpack it.

cd ~/development
tar xf ~/Downloads/flutter_linux_v1.0.0-stable.tar.xz

Check for required components.

Further they propose to add the flutter utility on the way so that you can run a diagnostics of the presence of all necessary components in the system.

export PATH=$PATH:`pwd`/flutter/bin

Then the utility flutter doctor is launched, which will show whether all the components are in the system

[-] Android toolchain - develop for Android devices
    • Android SDK at /Users/obiwan/Library/Android/sdk
    ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
    • Try re-installing or updating your Android SDK,
      visit https://flutter.io/setup/#android-setup for detailed instructions.

Specify paths to the Flutter SDK

First of all, they suggest indicating the paths to the Flutter SDK. For this you need:

  1. Find the directory where flutter was placed. If you followed the instructions, the path should look like this.
    /home/user/development/flutter/bin
  2. Open or create file
    $HOME/.bash_profile
  3. Add the path to the flutter sdk to this file
    export PATH=$PATH:/home/user/development/flutter/bin
  4. Update bash environment
    source $HOME/.bash_profile
  5. You can check that the path is added.
    echo $PATH

Install Android Studio

Since this is a configuration guide for Linux, you can use the installation of Android Studio through the snap system packages. It really is easier.

sudo snap install android-studio --classic

I’ll skip the default Android Studio setting, for example, setting a color scheme. Since the most important point is to install plugins for working with Dart and Flutter.

Android Studio Settings

Find these parameters in the settings File -> Settings

Android Studio Settings

Dart Plugin

Dart plugin

Flutter Plugin

Flutter plugin

Acceptance of licenses

You will need to run flutter foctor --android-licenses again to comply with all licenses.

Start a new Flutter project

After that you will be able to create Flutter project Start a new Flutter project

Start a new Flutter project

Select Flutter application

Flutter application

Specify Flutter SDK

Specify the domain of the company

After which a Flutter project will be created.

Pay attention to the project structure. External Libraries must have all the necessary components:

  1. Dart Packages
  2. Dart SDK
  3. Flutter for Android

If some of the items are not available, then you may need to either reinstall Flutter or correctly configure the paths in the IDE settings.

Dart Settings

Настройка Dart

Flutter Settings

Настройка Flutter

Connecting Android Smartphone

Next, connect a smartphone to your Android computer to perform the last item on the required components. You can certainly use an emulator, but personally I prefer a live device. In the end, Android smartphone in this case should be at hand.

And check that everything is in order through the flutter doctor.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale C.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
[✓] Connected device (1 available)

• No issues found!

Conclusion

After assembling and installing apk on a smartphone, you will see such an application.

We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Do you like it? Share on social networks!

Ruslan Polupan
  • Jan. 8, 2019, 7:35 a.m.

Доброго времени суток. В Андроид разработке новичек, посему будут вовросы.
Делал все по статье. Но получил следующую картину

rust@Leap15:~/Android/Sdk/tools/bin> flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale ru_RU.UTF-8)
    • Flutter version 1.0.0 at /home/rust/develop/flutter
    • Framework revision 5391447fae (6 недель назад), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

⣾Error retrieving device properties for ro.product.cpu.abi:
error: insufficient permissions for device
See [http://developer.android.com/tools/device.html] for more information


[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /home/rust/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    ✗ Android license status unknown.

[✓] Android Studio (version 3.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • 612HKBR8272WZ • 612HKBR8272WZ • android-arm • Android null (API null)

! Doctor found issues in 1 category.

При попытке обновить лицензии выдает следующе

rust@Leap15:~/Android/Sdk/tools/bin> /home/rust/Android/Sdk/tools/bin/sdkmanager --update
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 5 more

Подскажите в какую сторону копать.....

Evgenii Legotckoi
  • Jan. 8, 2019, 7:45 a.m.

Добрый день!

Саму Android Studio запускали? она должна скачать нужные SDK самостоятельно при первом старте. Либо запустите Android-Studio и посмотрите, что может выдать SDK Manager. То есть сделайте без консольных утилит это.

Я поэтому из snap устанавливал, там уже всё нормально настроено.

Comments

Only authorized users can post comments.
Please, Log in or Sign up
SH

C++ - Test 001. The first program and data types

  • Result:33points,
  • Rating points-10
г
  • ги
  • April 24, 2024, 1:51 a.m.

C++ - Test 005. Structures and Classes

  • Result:41points,
  • Rating points-8
l
  • laei
  • April 23, 2024, 7:19 p.m.

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:10points,
  • Rating points-10
Last comments
k
kmssrFeb. 9, 2024, 5:43 a.m.
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
EVA
EVADec. 25, 2023, 9:30 p.m.
Boost - static linking in CMake project under Windows Ошибка LNK1104 часто возникает, когда компоновщик не может найти или открыть файл библиотеки. В вашем случае, это файл libboost_locale-vc142-mt-gd-x64-1_74.lib из библиотеки Boost для C+…
J
JonnyJoDec. 25, 2023, 7:38 p.m.
Boost - static linking in CMake project under Windows Сделал всё по-как у вас, но выдаёт ошибку [build] LINK : fatal error LNK1104: не удается открыть файл "libboost_locale-vc142-mt-gd-x64-1_74.lib" Хоть убей, не могу понять в чём дел…
G
GvozdikDec. 19, 2023, 8:01 a.m.
Qt/C++ - Lesson 056. Connecting the Boost library in Qt for MinGW and MSVC compilers Для решения твой проблемы добавь в файл .pro строчку "LIBS += -lws2_32" она решит проблему , лично мне помогло.
Now discuss on the forum
G
GarApril 22, 2024, 3:46 p.m.
Clipboard Как скопировать окно целиком в clipb?
DA
Dr Gangil AcademicsApril 20, 2024, 5:45 p.m.
Unlock Your Aesthetic Potential: Explore MSC in Facial Aesthetics and Cosmetology in India Embark on a transformative journey with an msc in facial aesthetics and cosmetology in india . Delve into the intricate world of beauty and rejuvenation, guided by expert faculty and …
a
a_vlasovApril 14, 2024, 4:41 p.m.
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Евгений, добрый день! Такой вопрос. Верно ли следующее утверждение: Любое Android-приложение, написанное на Java/Kotlin чисто теоретически (пусть и с большими трудностями) можно написать и на C+…
Павел Дорофеев
Павел ДорофеевApril 14, 2024, 12:35 p.m.
QTableWidget с 2 заголовками Вот тут есть кастомный QTableView с многорядностью проект поддерживается, обращайтесь
f
fastrexApril 4, 2024, 2:47 p.m.
Вернуть старое поведение QComboBox, не менять индекс при resetModel Добрый день! У нас много проектов в которых используется QComboBox, в версии 5.5.1, когда модель испускает сигнал resetModel, currentIndex не менялся. В версии 5.15 при resetModel происходит try…

Follow us in social networks