0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

アンドロイドリントについて

Posted at

アンドロイドリントについて
Android Lint は、Android Studio 上でコードの品質や
潜在的な問題を静的解析によって検出し、開発者に助言を与えるツールです。
そして、Lint の各警告には「重大度(Severity)」が設定されており、
開発者はそれに応じて対応の優先度を判断できます。

image.png

lintOptionsの参考

android {
    lintOptions {
        abortOnError true         // エラーでビルド失敗
        warningsAsErrors true     // 警告もエラー扱いに
        checkReleaseBuilds true   // リリースビルドでも Lint を実行
        lintConfig file("lint.xml") // 詳細ルールは lint.xml に委譲
    }
}

lint.xml の例

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <!-- 未使用リソースを無視 -->
    <issue id="UnusedResources" severity="ignore" />

    <!-- ハードコードされた文字列は警告 -->
    <issue id="HardcodedText" severity="warning" />

    <!-- 新しいAPIの使用はエラー -->
    <issue id="NewApi" severity="error" />
</lint>

Lint Issue 一覧の取得方法

bash
$ ./gradlew lintDebug --stacktrace
$ lint --list
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?