FAQs and solutions for Android Studio use

Source: Internet
Author: User

Kids who are familiar with Android should be no stranger to Android Studio . Android programming has two common development environments, namely, Android Studio and Eclipse, previously used more than eclipse, and now, due to the superiority of Android studio, more and more people use it.

With the increase in the number of Android studio users, the use of the process of problems are increasingly prominent, the small part of this article on some Windows systems using Android Studio's frequently asked questions and solutions, you can watch onlookers, encounter similar problems, Try the tips below to share them.

1, assets file storage directory in the "src/main/" directory, and Java, res folder peer;

2. Refer to So in the Libs folder, you need to add the following attributes under the Android tab of the Build.gradle file under the corresponding module:

Android {

sourcesets {

Main {

Jnilibs.srcdirs = [' Libs ']

}

}

}

3, Android Studio compile-time mask off lint check, you can avoid the compilation condition is too strict and compile the problem:

lintoptions {

Abortonerror false

}

4. If you encounter a file conflict in more than one jar package, you can add the following attributes under the Android tab of the Build.gradle file under the corresponding module:

packagingoptions {

Exclude ' meta-inf/notice.txt '//Here is the full path of the specific conflict file

Exclude ' meta-inf/license.txt '

}

5, adjust the color of the Logcat file display: File→setting→editor→colors&fonts→android logcat→ on the right side of the interface to adjust the color Logcat each level of the log;

6, display line number: file→setting→editor→general→appearance→ check "show lines numbers";

7, Logcat console, display "No debuggable Applications" problem: tools→android→enable ADB integration;

8, if the dependency on the project and the main project has the same name of the same type of resource files, you need to modify the dependencies in the project resource name compilation will not error, if the dependency project in this resource file is not needed for the whole project, can be directly deleted;

9. In Android Studio, a master project relies on multiple libraries for schema compilation to be slow (clean and rebuild, before Eclipse is this mode), Because this kind of engineering framework is the main project and each dependent project has a build.gradle, it will take a long time to compile, can be no resource files and so of the dependency project into a jar package, there are resource files and so packaged into AAR files, and then referenced in the main project, so that the compilation will be quick;

10, Android Studio requirements for nine diagram is very strict, if the file ends with ". 9.png" But the picture is not 9, the compilation will be error, the solution is to open the image directly in as, through the 9 diagram editing tools to edit 9 diagram can be;

11. There are two ways to modify the dependency between module: (1) directly modify the dependencies in the Build.gradle file of each module, (2) Right-click Project→open module settings→ in the left modules column of the popup panel, select the module to modify the dependency, click on the right side of the depencencies tag to modify;

12. Android Studio Auto-guide: File→settings→editor→general→auto import→java→ Toggle "Insert imports on paste" to "all" → tick "Add Unambigious imports on the Fly ";

13, code format shortcut key: Ctrl+alt+l;

14, rename folder or file shortcut key: Alt+shift+r;

15, the mouse hover on a method, display the information of the method: Preferences→editor→show doc on mouse move;

16, delete a module, directly in the IDE to select the module after you press DELETE is not deleted, you need to right-click Project→open Module settings→ in the left modules column of the popup panel, select the "-" icon in the upper left corner of the panel to remove module→ click on the "-" symbol → Click OK to return to the IDE, and then select the module to be deleted, press the Delte shortcut key to delete it;

17, in the Android studio to execute lint and other tools for code detection, analyze→inspect codes.

The above is the use of Android studio, the most prone to the 17 problems and their solutions, it is not clear that children's shoes can be collected slowly experience.

Related article: "Android program ape must warn 13 pits"

FAQs and solutions for Android Studio use

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.