android-lint

How to re-enable a disabled Android Lint warning on file level

送分小仙女□ 提交于 2020-01-14 07:34:09
问题 I disabled the Android Lint warning 'HardcodedText' for a specific XML file (it's for a numeric key pad with fix text for the digits). I can't find a way to re-enable it on this file ('Restore Defaults' or so), neither in Windows > Preferences > Android > Lint Error Checking nor in Project > Properties > Android Lint Preferences . Any idea on how to re-enable a disabled warning on file level? 回答1: Found it out myself: Lint puts the file "lint.xml" to the project with the dependant items.

How to re-enable a disabled Android Lint warning on file level

纵然是瞬间 提交于 2020-01-14 07:34:09
问题 I disabled the Android Lint warning 'HardcodedText' for a specific XML file (it's for a numeric key pad with fix text for the digits). I can't find a way to re-enable it on this file ('Restore Defaults' or so), neither in Windows > Preferences > Android > Lint Error Checking nor in Project > Properties > Android Lint Preferences . Any idea on how to re-enable a disabled warning on file level? 回答1: Found it out myself: Lint puts the file "lint.xml" to the project with the dependant items.

Android - set all lint warnings as errors except for certain ones

隐身守侯 提交于 2020-01-02 01:23:41
问题 I am trying to make my continuous integration fail the build when new lint warnings that aren't in the lint-baseline.xml file are introduced. I want to have all lint warnings treated as errors (so the build is aborted), but I'd like a way to specify certain lint checks to be treated as informational or warning level so that they still appear in the lint results, but don't cause the build to be aborted. Here is an example of basically what I'd like to do (except this doesn't work, the build

Is it possible to TextView#getMaxLines() on pre api-16 devices?

非 Y 不嫁゛ 提交于 2020-01-01 16:38:19
问题 I used TextView#getMaxLines() in my application for a few weeks without incident. Lint is now informing me that it's only available in API 16+ ( #setMaxLines() is API 1+...), though (to the best of my knowledge) I haven't modified anything that would cause this sudden flag - my min-sdk has been 8 for a while, and I have files in my source control to prove it. 1) Why could lint be flagging this error randomly? (To be clear, I mean to say that it should have caught it initially - I'm not

Writing custom lint warning to check for custom annotation

主宰稳场 提交于 2019-12-28 12:34:08
问题 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

Why is 0dp considered a performance enhancement?

前提是你 提交于 2019-12-28 01:44:30
问题 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">

Why is 0dp considered a performance enhancement?

不打扰是莪最后的温柔 提交于 2019-12-28 01:43:48
问题 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">

Android enable warning for custom library if new version is available

混江龙づ霸主 提交于 2019-12-25 08:47:50
问题 With the support libraries, for example, Android Lint will show a warning if the library is not using the latest version. However, when I created my own library and published it through Bintray, no warning is displayed when using an older version. Is there any way to enable this behavior for custom libraries as well? 回答1: You can do the following in your Android Studio. Settings > Editor > Inspections > "Newer Library Versions Available" This will introduce a lint check on your gradle

How to avoid complier warning Parameter 'x' is never used

孤者浪人 提交于 2019-12-25 01:00:20
问题 Suggest the best way to solve this type of compiler warning in Android Studio 3.3 Note: I found many solutions to avoid the warnings and uncheck the Studio inspection. But I am expecting something different. Example: If warning Parameter 'view1' is never used is in the button onClick method. Method fun buttonClicked(view1: View) { // Call Intent to new Activity . // Parameter **view1** is not used } Call method from XML <Button android:id="@+id/button_id" android:layout_height="wrap_content"

Ignoring Android Lint “MissingTranslation” check for partial translations

夙愿已清 提交于 2019-12-22 13:02:01
问题 In my app I have a set of languages with complete translations, and another set of languages with translations for only a few strings. For the languages with complete translations, I want Lint to warn me about MissingTranslations. For the languages with partial translations, I want to Lint to ignore the MissingTranslations. I can't figure out how to achieve both of these goals at the same time. 回答1: On the warning marker, press Ctrl - 1 to show the available quickfixes. You can choose to