> For the complete documentation index, see [llms.txt](https://ecm-pmdm-flutter.gitbook.io/1.-introduccion-a-flutter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ecm-pmdm-flutter.gitbook.io/1.-introduccion-a-flutter/3.-primera-aplicacion-en-flutter/desde-android-studio.md).

# Desde Android Studio

{% hint style="info" %}
Toda la información y detalles: <https://docs.flutter.dev/get-started/test-drive?tab=androidstudio>
{% endhint %}

{% hint style="danger" %}
**Atención**: Los *plugins* de Dart y Flutter han de estar instalados y habilitados. &#x20;
{% endhint %}

## Creamos un nuevo proyecto Flutter

1. Abrimos Android Studio y elegimos: **`Crear New Flutter Project`**:

![](/files/vruzGcwVmXCbLuMkRP63)

2\. Escribimos el **nombre** del proyecto: ***helloflutter***, (eligimos las opciones que se ven en la imagen y completamos con helloflutter la sección *More Settings*)&#x20;

3\. Pulsamos **`Finish`** para crear el proyecto.

![](/files/ibN3zogy14PiCdxim6lK)

4\. El **proyecto** Flutter quedaría similar a la siguiente imagen (con el fichero *main.dart* abierto en el editor):

![](/files/xqJvspVaXPFjj8UwcotU)

<details>

<summary>Si es necesario, configuramos Project Settings....</summary>

En principio, los siguientes pasos no serían necesarios (solo si detectamos problemas al ejecutar o al editar el proyecto Android):

1. Abrimos Project Settings y cambiaremos al último SDK  y versión de java compatible en **Project** y en **Modules:**

<img src="/files/HdJ5WMAAZ8tI6EQxgnmH" alt="" data-size="original">

2. Abrimos **`android/app/build.gradle`**:

<img src="/files/1q5qd6r6BLtpPfmcMswx" alt="" data-size="original">

y sustituimos ***`GradleException`*** por ***FileNotFoundException***:

<img src="/files/dSLi9cfao1DUej010sDv" alt="" data-size="original">

</details>

## **Ejecutamos la aplicación**

* **Arrancamos** un AVD Android&#x20;
* **Ejecuta** la aplicación desde el menú o la barra de herramientas, que arrancará: lib/**main.dart**

![](/files/fdrw41nsurIgpIvaHvcL)

<details>

<summary><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>Gradle warnings</strong></summary>

Si, al ejecutar, vemos en la ventana "Run" que gradle muestra mensajes de warning, es por la versión de gradle:  la *actualizaremos* en *build.gradle* y en *gradle-wrapper.properties.*

<img src="/files/CsdugT8uZoRAYb73y4Ec" alt="" data-size="original">

</details>

![](/files/5jCe0YhZx5VDgBVqY3jv)

### Probamos hot reload

Cuando desarrollamos con Flutter, podemos utilizar :zap: **`hot reload`** para reflejar de forma **instantánea** los cambios del código en la aplicación que se está ejecutando, sin necesidad de reiniciar la ejecución (y conservando el estado)

Vamos a probarlo, **abrimos** *main.dart*&#x20;

* **Cambiamos** el texto de la barra del título  'Flutter Demo Home Page' por *'**HELLO FLUTTER**'*
* Veremos los cambios en ejecución en el momento que **guardamos** el fichero o pulsamos el **icono** de **`Hot Reload`** (o si ponemos en primer plano el dispositivo)
* Y vemos el **resultado** de inmediato en el dispositivo:

![](/files/yawdjQlllp5pkWcMB0Px)

> **Atención**: Hot reload puede no siempre ser posible. En algunas ocasiones, se tendrá que hacer un *hot restart,* o un *full restart*.   Para más detalles, consultar la documentación:
>
> <https://docs.flutter.dev/development/tools/hot-reload>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ecm-pmdm-flutter.gitbook.io/1.-introduccion-a-flutter/3.-primera-aplicacion-en-flutter/desde-android-studio.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
