Este documento fornece uma visão geral do desenvolvimento de aplicativos Android, incluindo como configurar o ambiente de desenvolvimento com o Android Studio, criar um primeiro projeto e entender a estrutura básica de um projeto Android.
Configurando o ambiente para desenvolvimento Android
1. This work is licensed under the Apache 2.0 License
Android Study Jams
Configurando o ambiente para o desenvolvimento
Android
2. Calleb J. Miquissene
DSC Lead, Founder – AlugAqui,
Android Engineer
Estudante de Desenvolvimento de Softwares
DSC Lead
Android Developer, Firebase App Developer
La Casa de Papel, !Game of Thrones
Tabs, !Spaces
!Animes
Sobre mim
3. This work is licensed under the Apache 2.0 License
Objectivos deste programa
० Aprender os conceitos básicos da linguagem Kotlin
० Criar diferentes tipos de aplicacoes Android
० Melhores praticas para o desenvolvimento Android
० Descobrir recursos para continuar aprendendo…
4. This work is licensed under the Apache 2.0 License
० Experiencia com uma lingaguem orientada a
objectos
० Computador
० Conexao a internet
Pre-requisitos
5. This work is licensed under the Apache 2.0 License
Visão Geral
Android e um sistema operativo
baseado no núcleo Linux.
Ele está presente em diversos
dispositivos, desde
smartphones, carros e relógios.
6. This work is licensed under the Apache 2.0 License
Android Studio
É o ambiente ou IDE oficial
para o desenvolvimento de
aplicações Android
7. This work is licensed under the Apache 2.0 License
Android Emulator
É o dispositivo físico ou virtual que usaremos
para testar as aplicações em
desenvolvimento.
8. This work is licensed under the Apache 2.0 License
O Desenvolvimento Android usa O Kotlin em Primeiro
Lugar
9. This work is licensed under the Apache 2.0 License
Kotlin é uma linguagem de programação moderna que
ajuda os desenvolvedores a serem mais productivos.
10. This work is licensed under the Apache 2.0 License
Beneficios do Kotlin
● Expressiva & Concisa
● Código Seguro
● Interoperável com Java
11. This work is licensed under the Apache 2.0 License
Após a instalação do Android
Studio, esta janela aparecerá
na tela do seu computador.
A partir dela você poderá
criar o seu primeiro projecto
android clicando em “Start a
New Android Studio
Project”
Primeiro projecto
12. This work is licensed under the Apache 2.0 License
Escolha o template para o
teu primeiro projecto.
No nosso caso escolhemos o
template “Empty Activity”
Você poderá adicionar mais
templates a sua aplicação ou
modificar o actual ao longo
do desenvolvimento.
Escolhendo o template
13. This work is licensed under the Apache 2.0 License
Depois de escolher o
template, você tem que
configurar o seu projecto.
Name refere-se ao nome do
teu projecto/aplicação.
Package name pode não ser
alterado, desde que siga a
estrutura:
com.example.nomedaapp
Configurando o projecto
14. This work is licensed under the Apache 2.0 License
Save location é o caminho
do folder onde o teu projecto
estará armazenado no disco.
Language é a linguagem de
programação que será
usada para o
desenvolvimento do projecto
(no nosso caso Kotlin).
Configurando o projecto
15. This work is licensed under the Apache 2.0 License
Minimum SDK: É a versão
mínima do Android que a sua
aplicação irá suportar.
É recomendável escolher
essa versão cautelosamente
olhando para o publico alvo
da sua aplicação.
Quanto mais antiga for a
versão do seu Minimum
SDK, menor perfomance terá
a sua aplicação.
Configurando o projecto
16. This work is licensed under the Apache 2.0 License
Após ter seguido todos os
passos você deverá ver esta
janela na telo do seu
computador.
Este é o ambiente onde você
desenvolverá as suas
aplicações Android.
Entendendo a estrutura do
projecto
17. This work is licensed under the Apache 2.0 License
Caso o android studio reporte
alguns erros, conecte o teu
computador à internet, vá em
menu File e clique em Sync
Project with Gradle Files.
Aguarde o processamento.
Estes erros acontecem caso o
Android Studio não tenha
baixado todos os
componentes do SDK
necessários para o teu
projecto.
Entendendo a estrutura do
projecto
18. This work is licensed under the Apache 2.0 License
app/java/com.example.andro
idstudyjams/MainActivity.kt
é o caminho do arquivo
MainActivity.kt.
Aqui é onde vamos manipular
as views do template que
escolhemos, ou seja a
interação entre o usuário e
tela da aplicação.
Esta manipulação é feita em
código Kotlin.
Entendendo a estrutura do
projecto
19. This work is licensed under the Apache 2.0 License
app/res/layout/activity_main.
xml é o caminho do arquivo
activity_main.xml.
Aqui é onde iremos fazer o
design da tela do template que
escolhemos para nossa
aplicação. O design é feito em
linguagem XML ou pode ser
feito arrastando os widgets
para a tela.
Entendendo a estrutura do
projecto
Hinweis der Redaktion
Let’s talk about what you will learn as part of this track of Android Study Jams. First you will learn the essentials of the Kotlin programming language, the language you’ll use to develop Android apps. Then you will install Android Studio on your computer and build a variety of Android apps in Kotlin by following the codelabs provided in the curriculum. Along the way, you will be learning best practices for Android, including app architecture and UI development. Another goal is to introduce you to the resources for where you can continue to learn Android development on your own.
Here are some the prerequisites that will be helpful for this first session of the track. As mentioned earlier, we assume that you already have programming experience in an object-oriented programming language. You will also need a computer with internet connection to do the exercises in this session.
[Mention WiFi instructions if necessary. Having access to an Android device is a nice-to-have starting in the next session, but not needed for this first session.]
Alright, let’s dive in and answer this question: what is Kotlin?
Android Studio is the official tool that professional Android developers use to build Android apps. There is a lot of functionality available in Android Studio to help you build your app. For example, there are templates to help you create your app, which can generate something like what you see in this screenshot. You can browse project files on the left. You can use the Layout Editor to drag-and-drop UI components and create a layout for your app. Once you add a UI component, you can modify its attributes in the Attributes window on the right hand side.
After you install Android Studio on your computer, you’ll create a Hello World app. You will learn to run the app in the emulator, which emulates an Android device on your computer. The emulator allows you to test your app on a variety of devices and versions of the Android platform. If you have a physical device, you’ll get the instructions to run it on your physical device as well.
How does this relate to Android development? In 2017, Google announced that Kotlin would be another officially supported language on Android. Then in 2019, Google announced that Android development would become increasingly Kotlin-first, so that new tools and libraries will first be made available in Kotlin. To further their commitment, Google and JetBrains formed the Kotlin Foundation to protect, promote, and advance the Kotlin language.
Within the span of several years, Kotlin has seen rapid adoption in the Android developer ecosystem. Over 70% of the top 1000 Android apps use Kotlin and 60% of professional Android developers use Kotlin. There has never been a better time to start learning Kotlin to take advantage of the latest features on Android.
On that note, let’s dive in and look at the basics of what Kotlin code looks like.
Resources:
Android's Kotlin-first approach
Kotlin is a modern programming language that helps developers be more productive. It was started as a project by JetBrains in 2010 and was made open source under the Apache 2.0 license, with Kotlin 1.0 released in 2016. The language has quickly gained traction among the developer community and in industry. Kotlin is one of the fastest growing programming languages, according to GitHub.
Resources:
Kotlin
GitHub State of the Octoverse
These are some of the key benefits that developers enjoy with Kotlin:
The Kotlin language is expressive and concise, allowing you to express your ideas with less code. This reduces the amount of boilerplate code in your project.
Kotlin helps you write safer code, with features that help you minimize common programming errors like NullPointerExceptions.
Kotlin is 100% interoperable with Java, which means you can call Java-based code from Kotlin and vice-versa. If you already have an existing Android app in Java, you can add as little or as much Kotlin to the project as you want.
Another key benefit that Kotlin offers is structured concurrency with Kotlin coroutines. They simplify background task management for everything from network calls to accessing local data, which are common for mobile apps.
Kotlin has many great language features, and Kotlin is now the #4 most loved programming language according to the Stack Overflow’s 2020 Survey.
Resources:
Kotlin
Stack Overflow Developer Survey in 2020