android-lint

How Do We Configure Android Studio to Run Its Lint on Every Build?

冷暖自知 提交于 2019-11-28 16:18:14
Once upon a time, particularly in Eclipse-land, Lint would run on every build, and so if you failed Lint checks, you would find out immediately. With Android Studio (tested on 1.3), Lint does not run by default on a build. Newcomers might make mistakes that Lint would check, but since Lint doesn't actually run, the newcomers don't find out about them. (IOW, if a Lint test did not run in a forest, is there really a Lint test?) Comments on this blog post show how to kinda sorta get Lint to run as part of a build: Edit the project configuration In the General tab of the configuration, scroll down

Missing support for Firebase App Indexing (android lint)

余生颓废 提交于 2019-11-28 15:29:23
I receive this lint warning when analysing my code (Analyse > Inspect Codes) on Android studios. App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler. See issue explanation for more details. What is this warning, and how do I make my app indexable by Google Search? it sounds important for SEO, but I can't find any details on Google. I also like to know how to access the "Issue Explanation" from android studio. Edit: "App is not indexable by Google Search" was the old warning. The new warning is "Missing support for Firebase App Indexing

Writing custom lint warning to check for custom annotation

风格不统一 提交于 2019-11-28 07:50:48
I have written the following annotation: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) @Target({ElementType.METHOD}) public @interface Warning { } Which is intended to annotate methods which can cause problems if called carelessly. I added an annotation processor to my project, but this only provides the warning in the log output of the javac command. I want this warning to appear in Android Studio along with the other lint warnings anywhere a

Meaning of “No label views point to this text field” warning message

女生的网名这么多〃 提交于 2019-11-28 07:12:40
What is the meaning of this warning? No label views point to this text field with an android:labelFor="@ id/@ id/editText1" attribute Note that the double id ( @id/@id ) is a problem with the error message text and does not reflect the XML content (which is the correct syntax). The labelFor is an attribute for accessibility options. You assign this to a label so that if, on a form , user clicks a textedit field , android can know what to read (TalkBack) to user. The id you assigned to it doesn't seem to be a valid one. why there are two @id in the id? Use ids like this: @id/editText1 I've had

Android Lint report for my project only, excluding library projects?

孤人 提交于 2019-11-27 21:56:11
How do I run Android Lint so it only reports on my project module, and ignores any library projects I'm using? Even when I aim Lint at my project's module, it spews out lists of issues in the library projects which I'm not interested in - I want to focus effort on fixing issues in my own code. I can't see a parameter to specify whether it follows references to library projects or not, but maybe you can see how to do it. If you are using Eclipse, go to the library project's properties (right click on project -> Properties) and under "Android Lint Preferences" click "Ignore All" and than OK. The

Avoid Android Lint complains about not-translated string

坚强是说给别人听的谎言 提交于 2019-11-27 11:23:57
is it possible to specify that the strings in a file within the value-* directories are purposely not translated into other languages? I have a bunch of strings that are common for all the languages and need no translation, so I've created an unlocalized-strings.xml file within values directory.. Running Android Lint to check for problems it keeps saying that some translations are missing.. I do not want to disable this check on the whole project, I'd like to disable it only in some XML files.. is it possible? "title_widget_updater_service" is not translated in de, en, en-rUS, it Issue: Checks

Android Lint limit languages to check for missing translations

和自甴很熟 提交于 2019-11-27 08:37:09
My app supports only 2 languages - English and German. So I have such folders structure for languages strings: myproject/res/values/strings.xml myproject/res/values-de/strings.xml When I run Lint check I get many warnings about missing languages, that my app doesn't need to support: "some_string" is not translated in af, am, ar, be, bg, ca, cs, da, el, en-rGB, es, es-rUS, et, fa, fi, fr, hi, hr, hu, in, it, iw, ja, ko, lt, lv, ms, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rTW, zu This warnings makes very difficult to understand which strings is not

What is “android:allowBackup”?

独自空忆成欢 提交于 2019-11-27 05:54:23
Since the new ADT preview version (version 21) , they have a new lint warning that tells me the next thing on the manifest file (in the application tag): Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data) In the official website , they've written: A couple of new checks: you must explicitly decide whether your app allows backups, and a label check. There's a new command line flag for setting the library path. Many improvements to the incremental lint analysis while editing. What is this

Why is 0dp considered a performance enhancement?

ⅰ亾dé卋堺 提交于 2019-11-27 02:45:46
An answer at the end of this question has been filled out, combining remarks and solutions. Question I searched around but haven't found anything that really explains why Android Lint as well as some Eclipse hints suggest replacing some layout_height and layout_width values with 0dp . For example, I have a ListView that was suggested to be changed Before <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> </ListView> After <ListView android:id="@android:id/list" android:layout_width="match_parent" android

Run lint when building android studio projects

会有一股神秘感。 提交于 2019-11-27 00:56:40
I would like to be able to run the lint task when I'm building projects with android studio to ensure the lint rules are being followed. I have tried using task dependencies but with no luck. My teamcity build server uses the build task which runs the lint task, so that works great. However, android studio appears to use generateDebugSources and compileDebugJava tasks interchangeably when I have selected the debug build variant. Here is what I have tried in my build.gradle: assemble.dependsOn lint If you just want to configure your Android Studio project to run the lint check before the