Overview
Correctness | |
1 | warning OldTargetApi: Target SDK attribute is not targeting latest version |
1 | warning UnusedAttribute: Attribute unused on older versions |
2 | warning GradleDynamicVersion: Gradle Dynamic Version |
Security | |
5 | warning HardwareIds: Hardware Id Usage |
Usability | |
1 | warning GoogleAppIndexingWarning: Missing support for Firebase App Indexing |
Internationalization | |
1 | warning HardcodedText: Hardcoded text |
Internationalization:Bidirectional Text | |
1 | warning RtlEnabled: Using RTL attributes without enabling RTL support |
Disabled Checks (21) |
Target SDK attribute is not targeting latest version
../../build.gradle:9:
6 defaultConfig { 7 applicationId "com.ais.forcedpathtest" 8 minSdkVersion 16 9 targetSdkVersion 16 10 versionCode 1 11 versionName "1.0" 12 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
OldTargetApi
Correctness
Warning
Priority 6/10
Attribute unused on older versions
../../src/main/res/layout/activity_main.xml:19:
16 android:layout_marginLeft="8dp" 17 android:layout_marginRight="8dp" 18 android:layout_marginTop="8dp" 19 android:elevation="1dp" 20 android:scrollbars="vertical" 21 app:layout_constraintBottom_toBottomOf="parent" 22 app:layout_constraintHorizontal_bias="0.0"
UnusedAttribute
Correctness
Warning
Priority 6/10
Gradle Dynamic Version
../../build.gradle:27:
24 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 exclude group: 'com.android.support', module: 'support-annotations' 26 }) 27 compile 'com.android.support:appcompat-v7:26.+' 28 compile 'com.android.support:design:26.+' 29 compile 'com.android.support.constraint:constraint-layout:1.0.2' 30 testCompile 'junit:junit:4.12'../../build.gradle:28:
25 exclude group: 'com.android.support', module: 'support-annotations' 26 }) 27 compile 'com.android.support:appcompat-v7:26.+' 28 compile 'com.android.support:design:26.+' 29 compile 'com.android.support.constraint:constraint-layout:1.0.2' 30 testCompile 'junit:junit:4.12' 31 }
GradleDynamicVersion
Correctness
Warning
Priority 4/10
Hardware Id Usage
../../src/main/java/com/ais/forcedpathtest/MainActivity.java:80:
77 78 TelephonyManager tele = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 79 80 mTextView.append("\nIMEI/MEID: " + tele.getDeviceId()); 81 mTextView.append("\nPhone number: " + tele.getLine1Number()); 82 mTextView.append("\nSubscriber ID: " + tele.getSubscriberId()); 83 mTextView.append("\nSim Serial: " + tele.getSimSerialNumber());../../src/main/java/com/ais/forcedpathtest/MainActivity.java:81:
78 TelephonyManager tele = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 79 80 mTextView.append("\nIMEI/MEID: " + tele.getDeviceId()); 81 mTextView.append("\nPhone number: " + tele.getLine1Number()); 82 mTextView.append("\nSubscriber ID: " + tele.getSubscriberId()); 83 mTextView.append("\nSim Serial: " + tele.getSimSerialNumber());../../src/main/java/com/ais/forcedpathtest/MainActivity.java:82:
79 80 mTextView.append("\nIMEI/MEID: " + tele.getDeviceId()); 81 mTextView.append("\nPhone number: " + tele.getLine1Number()); 82 mTextView.append("\nSubscriber ID: " + tele.getSubscriberId()); 83 mTextView.append("\nSim Serial: " + tele.getSimSerialNumber()); 84 85 mTextView.append("\nNetwork: " + tele.getNetworkOperatorName());../../src/main/java/com/ais/forcedpathtest/MainActivity.java:83:
80 mTextView.append("\nIMEI/MEID: " + tele.getDeviceId()); 81 mTextView.append("\nPhone number: " + tele.getLine1Number()); 82 mTextView.append("\nSubscriber ID: " + tele.getSubscriberId()); 83 mTextView.append("\nSim Serial: " + tele.getSimSerialNumber()); 84 85 mTextView.append("\nNetwork: " + tele.getNetworkOperatorName()); 86 mTextView.append("\nNetwork Country: " + tele.getNetworkCountryIso());../../src/main/java/com/ais/forcedpathtest/MainActivity.java:108:
105 mTextView.append("\nConnecting to wikipedia, to show exposing of personal info over http.\n"); 106 107 try { 108 HttpURLConnection con = (HttpURLConnection) new URL("https://en.wikipedia.org/w/index.php?search=" + tele.getLine1Number()).openConnection(); 109 con.connect(); 110 mTextView.append("Http response: " + con.getResponseMessage() + "\n"); 111 } catch (Exception e) {
HardwareIds
Security
Warning
Priority 6/10
Missing support for Firebase App Indexing
../../src/main/AndroidManifest.xml:8:
5 <uses-permission android:name="android.permission.READ_PHONE_STATE"/> 6 <uses-permission android:name="android.permission.INTERNET"/> 7 8 <application 9 android:allowBackup="true" 10 android:icon="@mipmap/ic_launcher" 11 android:label="@string/app_name"
GoogleAppIndexingWarning
Usability
Warning
Priority 5/10
Hardcoded text
../../src/main/res/layout/activity_main.xml:48:
45 android:layout_marginRight="8dp" 46 android:layout_marginTop="8dp" 47 android:ems="10" 48 android:hint="Enter Yes" 49 android:inputType="textPersonName" 50 app:layout_constraintHorizontal_bias="0.505" 51 app:layout_constraintLeft_toLeftOf="parent"
HardcodedText
Internationalization
Warning
Priority 5/10
Using RTL attributes without enabling RTL support
../../src/main/AndroidManifest.xml:13:
10 android:icon="@mipmap/ic_launcher" 11 android:label="@string/app_name" 12 android:roundIcon="@mipmap/ic_launcher_round" 13 android:supportsRtl="true" 14 android:theme="@style/AppTheme"> 15 <activity android:name=".MainActivity"> 16 <intent-filter>
RtlEnabled
Bidirectional Text
Internationalization
Warning
Priority 3/10
Disabled Checks
One or more issues were not run by lint, either
because the check is not enabled by default, or because
it was disabled with a command line flag or via one or
more
lint.xml
configuration files in the project directories.
Suppressing Warnings and Errors
Lint errors can be suppressed in a variety of ways:
1. With a
2. With a
3. With a //noinspection comment in the source code
4. With ignore flags specified in the
5. With a
6. With a
7. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a
To suppress a lint warning with a comment, add a
To suppress a lint warning in an XML file, add a
To suppress a lint warning in a
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use
To suppress lint warnings with a configuration XML file, create a file named
The format of the
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
For more information, see http://g.co/androidstudio/suppressing-lint-warnings
1. With a
@SuppressLint
annotation in the Java code2. With a
tools:ignore
attribute in the XML file3. With a //noinspection comment in the source code
4. With ignore flags specified in the
build.gradle
file, as explained below5. With a
lint.xml
configuration file in the project6. With a
lint.xml
configuration file passed to lint via the --config flag7. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a
@SuppressLint("id")
annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as "UnusedResources"
or {"UnusedResources","UnusedIds"}
, or it can be "all"
to suppress all lint warnings in the given scope.To suppress a lint warning with a comment, add a
//noinspection id
comment on the line before the statement with the error.To suppress a lint warning in an XML file, add a
tools:ignore="id"
attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the xmlns:android
declaration:xmlns:tools="http://schemas.android.com/tools"
To suppress a lint warning in a
build.gradle
file, add a section like this:android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
}
}
Here we specify a comma separated list of issue id's after the disable command. You can also use
warning
or error
instead of disable
to change the severity of issues.To suppress lint warnings with a configuration XML file, create a file named
lint.xml
and place it at the root directory of the module in which it applies.The format of the
lint.xml
file is something like the following:<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
$ lint --ignore UnusedResources,UselessLeaf /my/project/path
For more information, see http://g.co/androidstudio/suppressing-lint-warnings