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
AD

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

  • Result:50points,
  • Rating points-4
m

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

  • Result:80points,
  • Rating points4
m

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

  • Result:20points,
  • Rating points-10
Last comments
ИМ
Игорь МаксимовNov. 22, 2024, 10:51 p.m.
Django - Tutorial 017. Customize the login page to Django Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
Evgenii Legotckoi
Evgenii LegotckoiNov. 1, 2024, 12:37 a.m.
Django - Lesson 064. How to write a Python Markdown extension Добрый день. Да, можно. Либо через такие же плагины, либо с постобработкой через python библиотеку Beautiful Soup
A
ALO1ZEOct. 19, 2024, 6:19 p.m.
Fb3 file reader on Qt Creator Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
ИМ
Игорь МаксимовOct. 5, 2024, 5:51 p.m.
Django - Lesson 064. How to write a Python Markdown extension Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
d
dblas5July 5, 2024, 9:02 p.m.
QML - Lesson 016. SQLite database and the working with it in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
Now discuss on the forum
Evgenii Legotckoi
Evgenii LegotckoiJune 25, 2024, 1:11 a.m.
добавить qlineseries в функции Я тут. Работы оень много. Отправил его в бан.
t
tonypeachey1Nov. 15, 2024, 5:04 p.m.
google domain [url=https://google.com/]domain[/url] domain [http://www.example.com link title]
NSProject
NSProjectJune 4, 2022, 1:49 p.m.
Всё ещё разбираюсь с кешем. В следствии прочтения данной статьи. Я принял для себя решение сделать кеширование свойств менеджера модели LikeDislike. И так как установка evileg_core для меня не была возможна, ибо он писался…
9
9AnonimOct. 25, 2024, 7:10 p.m.
Машина тьюринга // Начальное состояние 0 0, ,<,1 // Переход в состояние 1 при пустом символе 0,0,>,0 // Остаемся в состоянии 0, двигаясь вправо при встрече 0 0,1,>…

Follow us in social networks