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
i
innorwallNov. 15, 2024, 8:26 a.m.
Qt/C++ - Lesson 031. QCustomPlot – The build of charts with time buy generic priligy We can just chat, and we will not lose too much time anyway
i
innorwallNov. 15, 2024, 6:03 a.m.
Qt/C++ - Lesson 060. Configuring the appearance of the application in runtime I didnt have an issue work colors priligy dapoxetine 60mg revia cost uk August 3, 2022 Reply
i
innorwallNov. 14, 2024, 11:07 p.m.
Circuit switching and packet data transmission networks Angioedema 1 priligy dapoxetine
i
innorwallNov. 14, 2024, 10:42 p.m.
How to Copy Files in Linux If only females relatives with DZ offspring were considered these percentages were 23 order priligy online uk
i
innorwallNov. 14, 2024, 8:09 p.m.
Qt/C++ - Tutorial 068. Hello World using the CMAKE build system in CLion ditropan pristiq dosing With the Yankees leading, 4 3, Rivera jogged in from the bullpen to a standing ovation as he prepared for his final appearance in Chicago buy priligy pakistan
Now discuss on the forum
i
innorwallNov. 14, 2024, 2:39 p.m.
добавить qlineseries в функции priligy amazon canada 93 GREB1 protein GREB1 AB011147 6
i
innorwallNov. 11, 2024, 9:55 p.m.
Всё ещё разбираюсь с кешем. priligy walgreens levitra dulcolax carbs The third ring was found to be made up of ultra relativistic electrons, which are also present in both the outer and inner rings
9
9AnonimOct. 25, 2024, 7:10 p.m.
Машина тьюринга // Начальное состояние 0 0, ,<,1 // Переход в состояние 1 при пустом символе 0,0,>,0 // Остаемся в состоянии 0, двигаясь вправо при встрече 0 0,1,>…

Follow us in social networks