Full guidance for new users of Android Studio and new users of androidstudio

Source: Internet
Author: User
Tags jcenter eventbus

Full guidance for new users of Android Studio and new users of androidstudio
Complete Guide for new users of Android Studio

@ Author ASCE1885 Github short book Weibo CSDN

Download and install Android Studio

If your computer can go over the wall, go to the Android official website to download it, as shown in:

If you can't go over the wall unfortunately, it doesn't matter. You can download it from AndroidDevTools. This website basically covers all the tools required for Android development, and stores the files on Baidu cloud. The download speed is superb.

After the download and installation are complete, the system will download and update a series of files at the first startup. If the file has been moved to the wall, wait until the update is complete. If the file has not been moved to the wall, do not wait, the download will only fail. How can this problem be solved? You can disconnect the computer network, or find the idea. properties file under the bin directory of the Android Studio installation directory, and add a configuration item to disable the start running Wizard:

disable.android.first.run=true

In this way, start Android Studio again and the welcome page will soon be displayed:

Click Configure-Preference to go to the Preference settings page and search for proxy, as shown in. manually Configure the proxy server:

Android SDK online image Update Server can be found on AndroidDevTools:

Go back to the welcome page and click Configure-SDK Manager to go To the SDK Manager Management page. Then, go to the Preference page of SDK Manager, and set the proxy server here, select Force https ://... Sources to be fetched using http ://...」 Check box:

After the configuration is complete, wait for the SDK to automatically download and update.

Suggestions for migrating from Eclipse to Android Studio:
1) do not use the automatic migration function of Android Studio to automatically convert projects from Eclipse to Android Studio engineering structure. We recommend that you re-create a pure Android Studio project, manually copy src, lib, and other files;
2) Do not reuse the SDK used before Eclipse in Android Studio. We recommend that you use the SDK Manager provided by Android Studio to download it again;
3) In a word: Ensure the pure coverage of Android Studio.

Installation and Use of Android NDK

Not every app uses NDK. In fact, most apps do not need NDK. Therefore, the installation of NDK is independent of one section. You can skip the boots you are not interested in, the installation of NDK is relatively simple. You only need to download the NDK compressed package from NDK Downloads or AndroidDevTools and decompress it to the local directory.

Add the ndk. dir variable to the local. properties file in the root directory of the Android project. The value points to the absolute path of the ndk, for example:

## This file is automatically generated by Android Studio.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file should *NOT* be checked into Version Control Systems,# as it contains information specific to your local configuration.## Location of the SDK. This is only used by Gradle.# For customization when using a Version Control System, please read the# header note.sdk.dir=/Users/guhaoxin/Library/Android/sdkndk.dir=/Users/guhaoxin/Library/Android/android-ndk-r10

NDK can be used in two forms: one is to obtain the third-party so file, we encapsulate the native interface provided by JNI to the Java layer. Another method is to compile the underlying code using C/C ++, compile the so file, and repeat the first method. The specific implementation is still troublesome and the length is relatively large. You can refer to the following articles for the boots you need:

  • NDK with Android Studio
  • Android Studio, gradle and NDK integration
  • Share code between projects in Android Studio
  • Using custom Android. mk with Gradle/Android Studio

Wait for time and then combine the actual project to organize an entry guide for Android Studio + NDK.

Basic usage of Android Studio

The basic usage of Android Studio is trivial and the length is large. Many articles have been introduced, so I will not explain it here. For details, refer to the series of tutorials of @ StormZhang, the tutorial is based on Android Studio 1.0, which is slightly different from the latest version, but does not affect our learning.

Android Studio series Tutorials:

  • Download and install
  • Basic settings and running
  • Shortcut Key
  • Gradle Basics
  • Gradle command details and import third-party packages
  • Gradle multi-channel Packaging
Basic usage of Android Gradle Plugin

After reading the above series of tutorials, you should have a basic understanding of Gradle, but it is not enough. You must carefully read the Gradle Plugin User Guide before you can basically cope with daily development work. If you want to go further, read the full Gradle User Guide. Of course, according to Mr. Wang shouren's idea of "integration of knowledge and practice", it is a waste of effort to read more and not practice well in the project.

Of course, if you find that gradle compilation is slow, you can try the methods described in Boosting the performance for Gradle in your Android projects, which may be useful to you.

Use Gradle to publish a project to JCenter

Currently, most Android projects on Github have been migrated from the Eclipse + Ant mode to the Android Studio + Gradle development mode. To facilitate the dependency management of function libraries, the compressed packages generated by function libraries are released to the JCenter, in this way, third-party projects need to use the function library, only need to build. add a line of code to the gradle file. For example, if my project uses EventBus, set it as follows:

dependencies {    compile 'de.greenrobot:eventbus:2.4.0'}

The problem arises. If I have developed a function library and want to provide it to a third party in this way, I need to publish the project to the JCenter.

Of course, the premise is that your function library is open-source or obfuscated. Otherwise, you will give up this idea before being fired by the company, and honestly provide the Jar package directly to a third party.

There have been many good articles about the entire release process. It is recommended that you read the two articles from Android Studio release project to Jcenter and Android project to JCenter package.

JDK version downgrade

For more information about whether to downgrade the JDK version used by Android Studio from JDK 7 or JDK 8 to JDK 6, see the article I wrote earlier: Modify the JDK version used by Android Studio on Mac.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.