Showing posts with label Android Studio.how to. Show all posts
Showing posts with label Android Studio.how to. Show all posts

Building interfaces with ConstraintLayout in Android Studio

The new Layout Editor in Android Studio 2.2 include a new blueprint mode, revamped properties inspector and support for ConstraintLayout, a new way to define layouts for your apps.


In this Android Tool Time episode Wojtek Kaliciński shows you the basics of working with ConstraintLayouts in the visual editor. If you want to try it out yourself, you can find our codelab here: https://codelabs.developers.google.com/codelabs/constraint-layout

When you’re familiar with the layout editor interface, read the rest of our Medium article where you’ll find some more advanced tips and tricks for ConstraintLayout: https://goo.gl/a5orYw


IOException: not create document. Error

When I prepare the example "Display PDF in assets folder (inside APK)", I face with the error of "java.io.IOException: not create document. Error". It should be generated by the code:

pdfRenderer = new PdfRenderer(fileDescriptor);


Somebody commented it's caused by new version of Gradle (ref: https://github.com/googlesamples/android-PdfRendererBasic/issues/1), so I edit dependencies of buildscript in build.gradle (Project: ...), use gradle:2.1.2 to solve this problem.


Change minSdkVersion, targetSdkVersion, compileSdkVersion in Android Studio



To change minSdkVersion in Android Studio:

- Right click your app -> Open Module Settings

- Select app and Flavors tab, select your new Min Sdk Version, then OK.

- minSdkVersion changed.

You can also change targetSdkVersion, compileSdkVersion (under Properties tab) also.

Beginning Android Programming with Android Studio 4th Edition

A hands-on introduction to the latest release of the Android OS and the easiest Android tools for developers

Beginning Android Programming with Android Studio

As the dominant mobile platform today, the Android OS is a powerful and flexible platform for mobile device. The new Android 7 release (New York Cheesecake) boasts significant new features and enhancements for both smartphone and tablet applications. This step-by-step resource takes a hands-on approach to teaching you how to create Android applications for the latest OS and the newest devices, including both smartphones and tablets.
  • Shows you how to install, get started with, and use Android Studio 2 - the simplest Android developer tool ever for beginners
  • Addresses how to display notifications, create rich user interfaces, and use activities and intents
  • Reviews mastering views and menus and managing data
  • Discusses working with SMS 
  • Looks at packaging and publishing applications to the Android market
Beginning Android Programming with Android Studio starts with the basics and goes on to provide you with everything you need to know to begin to successfully develop your own Android applications.

Expert Android Studio

Take your Android programming skills to the next level by unleashing the potential of Android Studio

Expert Android Studio

Expert Android Studio bridges the gap between your Android programing skills with the provided tools including Android Studio, NDK, Gradle and Plugins for IntelliJ Idea Platform. Packed with best practices and advanced tips and techniques on Android tools, development cycle, continuos integration, release management, testing, and performance, this book offers professional guidance to experienced developers who want to push the boundaries of the Android platform with the developer tools. You'll discover how to use the tools and techniques to unleash your true potential as a developer.
  • Discover the basics of working in Android Studio and Gradle, as well as the application architecture of the latest Android platform
  • Understand Native Development Kit and its integration with Android Studio
  • Complete your development lifecycle with automated tests, dependency management, continuos integration and release management
  • Writing your own Gradle plugins to customize build cycle
  • Writing your own plugins for Android Studio to help your development tasks.
Expert Android Studio is a tool for expert and experienced developers who want to learn how to make use of the tools while creating Android applications for use on mobile devices.

MPAndroidChart, a powerful Android chart view / graph view library.


MPAndroidChart is a powerful Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations. This video show how to download and run its example in Android Studio/Emulator.


Install Android Studio 2.1.2 on Linux Mint 17.3 Rosa


This video show how to install Android Studio (currently 2.1.2) on Linux Mint 17.3 Rosa run on VirtualBox/Windows 10.

Before install Android Studio, have to install jdk. Refer to Install Oracle Java8 on Linux Mint 17.3 Rosa.


Enter in Terminal:
$ sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
$ sudo apt update
$ sudo apt install ubuntu-make
$ umake android

After reboot, launcher icon of Android Studio will appear in Linux Mint Menu.



What’s New in Android Studio 2.1

Android Studio 2.1 is required to try out new features and APIs of the Android N developer preview including the new Jack compiler and Java 8 language support. It also includes performance improvements to Instant Run, and a number of bug fixes and stability improvements.

Android Studio 2.1 is now available to download through the Stable release channel.


Fixed for the time being, error of "umake android" on Ubuntu 16.04: A default framework for category Android was requested where there is none

Android Studio 2.0 on Ubuntu 16.04
Refer to the last post "Error in installing Android Studio on Ubuntu 16.04 using umake", when I install Android Studio on Ubuntu 16.04 using umake, error message show "ERROR: A default framework for category Android was requested where there is none".


Android studio and the sdk changed the download pages significantly.
They've been fixed in master, and will be working again in the next release.

If you need you can clone the repository and install from that.
It's less than ideal, but if it can help you for the time being.

git clone https://github.com/ubuntu/ubuntu-make
cd ubuntu-make
bin/umake android

reference: LyzardKing comments in https://github.com/ubuntu/ubuntu-make/issues/302

This video show how:


Onced installed. openjdk version "1.8.0_03-Ubuntu" will also be installed.


Updated@2016-05-24:
Another approach is to add the ppa to get the latest version.
It's updated frequently as it's easier to upload a version to a ppa.

$ sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
$ sudo apt update
$ sudo apt install ubuntu-make


Error in installing Android Studio on Ubuntu 16.04 using umake

Updated@2016-04-24:
Fixed for the time being, read next post.



I tried to install Android Studio on Ubuntu 16.04 using umake, refer "Install Android Studio 2.0 on 64-bit Ubuntu 15.10 with Ubuntu Make (umake)". It's reported with error of:


$ umake android
ERROR: A default framework for category Android was requested where there is none
usage: umake android [-h] {android-ndk} ...







Add Google Play Services to Android Studio project

To add Google Play Services to Android Studio project, make sure Google Play services SDK is installed.


Open Project Structure to add dependencies of compile 'com.google.android.gms:play-services:8.4.0' to app/build.gradle.

To open Project Structure:
- Click File - Project Structure, or
- Right click your App, select Open Module Setting..., or
- With your App selected, press F4.

Follow the video to add 'com.google.android.gms:play-services:x.x.x' to your module.


After finished,  dependencies of compile 'com.google.android.gms:play-services:8.4.0' will be added to app/build.gradle.




Install Android Studio 2.0 on 64-bit Ubuntu 15.10 with Ubuntu Make (umake)


To install Android Studio (current 2.0) on 64-bit Ubuntu 15.10, it's easy by using Ubuntu Make. It install OpenJDK also.


Enter the command in Terminal:
- Install Ubuntu Make:
$ sudo apt-get install ubuntu-make

- Install android-studio:
$ umake android

if error reported "ERROR: We were expecting to find a license on the download page, we didn't." install android-studio with --accept-license option:
$ umake android --accept-license

(thanks Anonymous's comment in last post "ERROR: We were expecting to find a license on the download page, we didn't."
ref: http://askubuntu.com/questions/755497/error-in-installing-android-studio-using-ubuntu-make)

This video show how to install Ubuntu Make (umake) on Ubuntu 15.10 (running inside VirtualBox), and install Android Studio 2.0 using umake.



About Ubuntu Make
Ubuntu Make is a command line tool which allows you to download the latest version of popular developer tools on your installation, installing it alongside all of the required dependencies (which will only ask for root access if you don't have all the required dependencies installed already), enable multi-arch on your system if you are on a 64 bit machine, integrate it with the Unity launcher. Basically, one command to get your system ready to develop with!

remark@2016-04-23:
BUT error to install on Ubuntu 16.04 LTS, read more "Error in installing Android Studio on Ubuntu 16.04 using umake".



What’s New in Android Studio 2.0

Android Studio 2.0 is focused on making your workflow faster. Faster builds, faster deployment, faster emulators. Everything. Faster.

As developers any time spent waiting for our IDE to do something is time wasted. Time we could be writing code, time that pushes out the end of our day, or a break that risks dropping us out of the zone.

Android Studio 2.0 includes Instant Run to reduce incremental build and deploy times to seconds, improved full build times, a faster and more intuitive emulator, and a new GPU profiler to help make your games and graphics apps performant and error free.


Android Studio 2.0 is now available to download:
http://developer.android.com/sdk/index.html

Find out more about Android Studio 2.0 feature here:
https://medium.com/google-developers/android-studio-2-0-beta-what-s-new-87f8b3946888#.bv3ovscio

Learn more about Android Studio with Android Tool Time:
~ Android Tool Time on Youtube


Fixed: ERROR: We were expecting to find a license on the download page, we didn't.

Fixed, refer to another post "Install Android Studio 2.0 on 64-bit Ubuntu 15.10 with Ubuntu Make (umake)".

Thx Anonymous's comment:)




I tried to install Android Studio on Ubuntu 15.10 using ubuntu-make (refer Install Android Studio on 64-bit Ubuntu 15.10 with Ubuntu Make (umake)), it show error:
ERROR: We were expecting to find a license on the download page, we didn't.


Anybody know how?
Or may be it's error on the download page, not on me.

Error:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in ...

After update Android Studio, most probably you will be recommended to update the Android Gradle Plugin:


Then, most probably again, "Error:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in ..." will be reported!


Just click the link of "Gradle settings" in Message View, and choice the correct Gradle home.

Alternatively, you can access Gradle home by:
Click File > Settings >
select tabs of Build, Execution, Deployment > Build Tools > Gradle


Android Studio 2.0 and Emulator 25.1.1 are officially now


Android Studio 2.0 and Emulator 25.1.1 are moved to stable release channels.
This release is focused on development productivity by introducing instant run and a much faster emulator. Please see our blog post for more details.

announcement: Android Tools Project Site - Android Studio 2.0 and Emulator 25.1.1 are Available in the Stable, Beta, and Dev Channels

Upgrade to Android Studio 2.0 from 1.5:


Android Studio error: Expected resource of type raw

In my exercise of setting wallpaper using resource inside APK, I tried to load resource from /res/drawable/ folder. But reported with error of "Expected resource of type raw".


My solution is to create /res/raw/ folder and move the resources to it. And load with R.raw....

This video show how: