Thank you @Xixicat for your inspiration. I hope this topic will continue in earnest. Other translations for CodePath Android will be carried out simultaneously.
The purpose of this project: learn the features and skills of Android Studio, learn the dark arts of Gradle, learn the hottest frameworks of Android, learn the new features of Android5.0 and above.
We will introduce the dark magic of Gradle, how to speed up the build process, and how to use Gradle easily and efficiently. After that, according to the construction of the project, we will introduce the relevant framework and use guide of Android.
The machine configuration of this topic: Mac Pro 13. Note that for Windows users, the configuration of Android Studio and Gradle are almost the same, so there is no need to worry.
So much for that, let’s get started!
Android Studio installation
I’m sure you all have Android Studio installed, so I’ll walk you through the installation process.
Here’s the link:
Developer.android.com/intl/zh-cn/…
You will need to install the JDK before installing it, so how to do that is beyond the scope of this blog post. I believe that the use of MAC shoes can be very easy to install.
Use of Android Studio
I’m not going to show you how to use Android Studio to create new projects, how to view logs, etc.
After installing Android Studio, I’m sure most users are already familiar with Eclipse shortcuts, so you’ll need to set up the following shortcut: CMD +, open Settings, and select Key Map:
Also, you need to set themes, fonts, etc., which I won’t cover here.
You also need to set up display line numbers, code prompt shortcuts, XML prompt shortcuts, variable plus M, S, automatic package guide, etc.
Plugin for Android Studio
Notice that Android Studio installs a lot of plugins by default, and there are some plugins that we don’t need to use, so how to improve The speed of Android Studio, you can remove some unnecessary plugins, like this. Here, I removed the plugins for Google services. At the same time, Since the emulator of Android Studio runs too slowly, we can install the Genymotion emulator, which has a corresponding plug-in in AS. You can install and feel the convenience brought by the emulator. (As for why we need to use the emulator, because when using SQLite, You don’t have to worry because you can’t view sqLite files on your mobile phone. On the emulator, just install root Project to quickly view sqLite files.
Since this is the first post, try to be as detailed as possible.
To install the Genymotion plugin, open Settings, select Plugins, and select:
Enter Genymotion, select Install, and restart Android Studio to see:
In this, I will introduce a plugin to you, ADB LDEA, how to install, and Genymotion is the same, input its corresponding name can be.
Use CMD + Shift +A to call:
Yes, that’s right, you can use shortcuts to control the app corresponding to the project, you can uninstall the app, install the app, delete files and other operations, isn’t it very convenient?
An overview of the Android studio
Since this is the first post, let’s take a look at Android Studio’s features.
Similar to Eclipse, in Android Studio, you can expand projects in different forms, usually using the two projects and Android. To see the differences, in Project:
Project will display all the files in your project, so there are some advantages in viewing related files and creating files.
So here’s the Android view:
Find gradle files, are they simple, are they clean, for each module?
Toggle the two, click View
Some people will ask, I clicked on view, it’s different from yours, don’t worry, because my Android Studio version is 2.0, so…
Why did you give me the link to download the latest version of 1.5.1, 2.0 or preview? How to upgrade to 2.0:
Check update, the specific operation process and the corresponding version of the relevant differences, please Google, the only thing I can say is: 2.0 speed is still improved compared to 1.5, and in my use, I did not find any bugs… Is it too spicy? Note, however, that if you upgrade to 2.0, your upgrade is irreversible, meaning you can’t go back to 1.5, so think about it.
Next, you’ll be dealing with them a lot:
This is used when you modify the build.grade file:
This is used to run app or test, with debug next to it:
This is for command line mode:
This is the log and associated memory view:
Here are all gradle tasks:
Useful shortcuts for Android Studio
There are so many shortcuts that I can’t possibly remember, but it’s worth remembering a few useful ones:
Later, you’ll find that you need to switch from the simulator to as mode, and when you run the app, AS will automatically open the log for you, so the question is, do I have to manually close this thing every time?
/** + Enter to quickly generate javadoc comments
CMD + touch pad to view the source
Other shortcut keys will be introduced in the construction process of the project.