Criando APP Android Nativo

(Usando SDK android já instalado no tutorial do PhoneGap)

Dependencias:
$ sudo aptitude install gradle

Se o seu SDK já tem algum tempo, atualize:
$ android update sdk
(Aproveite e instale "Android SDK Build-Tools")

Para criar um projeto:
$ android create project -n 'Bli' -t 'android-23' -p /tmp/bli -k com.aurium.bli -a BliActivity -g -v 0.10.4

Detalhes na documentação oficial. -v é relativo a versão do plugin gradle.

Reultado:
/tmp/bli
├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── local.properties
└── src
    ├── androidTest
    │   └── java
    │       └── com
    │           └── aurium
    │               └── bli
    │                   └── BliActivityTest.java
    └── main
        ├── AndroidManifest.xml
        ├── java
        │   └── com
        │       └── aurium
        │           └── bli
        │               └── BliActivity.java
        └── res
            ├── drawable-hdpi
            │   └── ic_launcher.png
            ├── drawable-ldpi
            │   └── ic_launcher.png
            ├── drawable-mdpi
            │   └── ic_launcher.png
            ├── drawable-xhdpi
            │   └── ic_launcher.png
            ├── layout
            │   └── main.xml
            └── values
                └── strings.xml

Build:
$ cd /tmp/bli
$ ./gradlew assembleDebug

Run:
$ android avd
$ adb install build/apk/bli-debug-unaligned.apk

Editing the Hello World

The UI is defined at src/main/res/layout/main.xml. See the official docs to add your wanted changes.

The app main is defined at src/main/java/com/aurium/remotecontrol/RemoteControlActivity.java.

Rebuild with the same command:
$ ./gradlew assembleDebug

Note the "-r" to reinstall:
$ adb install -r build/apk/remote-control-debug-unaligned.apk

View the logs, like as "tail -f":
$ adb logcat

Filter logs to see only your activity:
$ adb logcat BliActivity *:S
Topic revision: r4 - 20 Oct 2015, AurelioAHeckert
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki-Colivre? Send feedback