Android Studio Usage Tips-FAQ Highlights

Source: Internet
Author: User

Organized some of the common problems encountered during this time, I hope that the apes are helpful ... If you find it useful, just praise it.


Question one:

Error: (9) Attribute [email protected] value= (@drawable/logo) from Androidmanifest.xml:26:9

Error: (28, 9) Attribute [email protected] value= (@style/themeactionbar) from Androidmanifest.xml:28:9
is also present at Xxxx-trunk:xxxxlib:unspecified:15:9 value= (@style/apptheme)
Suggestion:add ' tools:replace= ' android:theme ' to <application> element @ androidmanifest.xml:24:5 to override
Error:execution failed for task ': Xxxx:processdebugmanifest '.

> Manifest merger failed with multiple errors, see logs


Reason:

The Gradle plugin for as will enable the manifest merger Tool by default, and if the same properties as the master project are defined in the library project (such as the default generated Android:icon and Android:theme), the merge fails at this time. and report the above error.


There are 2 ways to solve the problem:

Method 1: add tools:replace= "Android:icon, Android:theme" under Manifest.xml's application tag (multiple attributes are separated, And remember to add xmlns:tools= "Http://schemas.android.com/tools" to the manifest root tag, otherwise you will not find namespace OH)

Method 2: add Useoldmanifestmerger True on the Build.gradle root label (lazy method)


Refer to the official introduction:

Http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger



Question two:

The Buildconfig.debug in the Library project is always false. This is a known issue with Android Studio, a Google siege Lion says that the Library projects currently only generates release packages.

Issue 52962:https://code.google.com/p/android/issues/detail?id=52962


Workaround:(the method recommended by a Google Siege Lion)

Workaround:instaed of Buildconfig.debug Create another Boolean variable at Lib-project ' s e.g. Buildconfig.release and Lin K it with application ' s buildtype.

Https://gist.github.com/almozavr/d59e770d2a6386061fcb


refer to this post on StackOverflow:

Http://stackoverflow.com/questions/20176284/buildconfig-debug-always-false-when-building-library-projects-with-gradle



Question three:

Each time you save, the extra spaces and tabs of each line are automatically deleted (for example, trailing, blank lines, or tab)

In particular, each time you prepare to submit Svn,review code, you have a sore egg, show a bunch of unrelated changes, see the dizzy.


Workaround:

Settings->ide Settings->editor->other->strip trailing spaces on Save->none



Question four:

Compile time, quote: Failure [INSTALL_FAILED_OLDER_SDK]. Generally, the system automatically helps you set up the Compilesdkversion


Workaround:

Modify Build.gradle under Compilesdkversion ' android-l ' to compilesdkversion 19 (or the SDK you already have on this machine)





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.