Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting
TIMEWEB

Flutter - Tutorial 001. Hello world

Android, Flutter, 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.

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

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

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

Добрый день!

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

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

Comments

Only authorized users can post comments.
Please, Log in or Sign up
ПМ
March 18, 2019, 3:12 p.m.
Пётр Махнёв

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

  • Result:50points,
  • Rating points-4
ЯГ
March 18, 2019, 7:59 a.m.
Ян Греку

C++ - Тест 003. Условия и циклы

  • Result:21points,
  • Rating points-10
МД
March 15, 2019, 4:32 p.m.
Михаил Дементьев

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

  • Result:60points,
  • Rating points-1
Last comments
March 16, 2019, 1:55 p.m.
Дмитрий

Спасибо за статью. Давно итересует следующий вопрос: с помощью переменных QMAKE_TARGET_COMPANYQMAKE_TARGET_PRODUCTQMAKE_TARGET_DESCRIPTIONможно задать свойства компилируемой программы, о...
JS
March 12, 2019, 10:19 a.m.
Jean Stefanovich

Большое спасибо за разъяснения!
March 12, 2019, 10:04 a.m.
Евгений Легоцкой

Hello, In fact, this functionality or is not implemented, or is not documented. I'm not sure. But I think, that it should be implemented in Text QML Type. Because of we can write text in...
March 12, 2019, 9:51 a.m.
Евгений Легоцкой

Да вы правы. На самом деле проще через QSqlQueryModel, сколько не пытался использовать эти дженерики типо QSqlTableModel и QSqlRelationalTableModel, то всегда упирался в какие-то их ограничени...
JS
March 12, 2019, 9:47 a.m.
Jean Stefanovich

Единицы измерения лежат там же где и названия продуктов. Просто в таблице ингредиенты нет ещё одного столбца, на который можно было бы установить setRelation. Я в итоге в базе создал ещё один ...
Now discuss on the forum
March 17, 2019, 10:47 p.m.
Евгений Легоцкой

Добрый день. Вот, нашлось у меня немного времени. Делается это через шаблон проектирования наблюдатель. GraphKS_mfvSlup.zip
ЧГ
March 15, 2019, 9:52 p.m.
Чарльз Грин

спасибо, попробую, отпишусь
m
March 15, 2019, 7:41 p.m.
mihamuz

Сори догадался)
n
March 12, 2019, 4:57 p.m.
newbie.works.with.QT

Большооооое спасибо!!!!!Не передать как я вам благодарен, спасибо что всегда отзываетесь.Теперь я смогу продолжить работу в QT!!! (пробую писать бота (Я как вы могли догадаться немного не пр...
March 12, 2019, 1:20 p.m.
BlinCT

Ну так если у вас есть готовая программа так ей и воспользуйтесь. Вы же написали ее вот и пользуйтесь.
Join us in social networks

For registered users on the site there is a minimum amount of advertising