Some pits in Androidstudio

Source: Internet
Author: User

The following environments for Android Studio 1.3.2,gradle 2.7 (as comes with 2.4, another download of 2.7)

Compile-time prompt multiple Dex files Define:lcom/sina/weibo/sdk/buildconfig exception

The Weibosdkcore.jar included in the SDK provided by Sina Weibo contains the Buildconfig class, and the API project also generates a class with the same name (the same as the package name), so there is this compilation exception. The workaround is to delete the Buildconfig.class file in the Weibosdkcore.jar directly using a tool (such as 7zip). There are other workarounds, this link is good.

Cannot clean project

Sometimes after clean still have the file residue (for example Classes.jar), at this time need to manually delete the project path under the build directory (delete may prompt Classes.jar is occupied, mostly as itself in use, can turn off as and retry). What's disgusting is that clean does not prompt you to have files that cannot be deleted.

Two project share a module

Suppose you write an Android library (name Library1) and then want to use it in both Project1 and Project2, but don't copy the Library1 two copies. The trick is to refer to Project1 resources in the Project2 Setting.gradle file as follows:

Include ':. /project1/library1 '

Reference links

Configuration with Name ' default ' is not found.

Check the Settings.gradle file for the presence of the module for include, which is usually caused by a non-existent module. Reference links

Proguard Hint Duplicate entry error

This problem occurs when more than one module relies on multiple identical jar files, and I was confronted with xutils, the solution being to find the corresponding repository on the Jcenter, instead of using the jar directly instead of using the repository solution. Proguard Troubleshooting

With Proguardfile or proguardfiles?

When you specify a project Proguard configuration file in Build.gradle, you can specify more than one with Proguardfiles, with Proguardfile you can specify a (multiple lines), and the test effect is the same. Note: You may not see the correct file name in the Module Settings dialog box. Another change: Comparing the new as version with the default file name is Proguard-rules.pro, formerly Proguard-rules.txt.

The value of Buildconfig.debug in the dependent module is always false

For example, module a relies on module B and Module C, and the value of Buildconfig.debug in B and C will be true when running in Eclipse (the export signature apk will automatically turn false); However, on Android The buildconfig.debug values in Studio B and C are always normal in false,a. This results in if (buildconfig.debug) {LOG.D (...)} The log does not display properly.

Some pits in Androidstudio

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.