Overview
Correctness | |
1 | warning OldTargetApi: Target SDK attribute is not targeting latest version |
6 | warning GradleDependency: Obsolete Gradle Dependency |
1 | error UnsafeOptInUsageError: Unsafe opt-in usage intended to be error-level severity |
Correctness:Chrome OS | |
1 | error PermissionImpliesUnsupportedChromeOsHardware: Permission Implies Unsupported Chrome OS Hardware |
Performance | |
4 | warning UnusedResources: Unused resources |
Usability:Icons | |
2 | warning MonochromeLauncherIcon: Monochrome icon is not defined |
Usability | |
2 | warning Autofill: Use Autofill |
Accessibility | |
1 | warning
ContentDescription: Image without contentDescription |
Internationalization | |
1 | warning SetTextI18n: TextView Internationalization |
10 | warning HardcodedText: Hardcoded text |
Included Additional Checks (20) | |
Disabled Checks (40) |
Target SDK attribute is not targeting latest version
../../build.gradle:12:
9 defaultConfig { 10 applicationId "com.example.dronerecognition" 11 minSdk 24 12 targetSdk 33 13 versionCode 1 14 versionName "1.0" 15
OldTargetApi
Correctness
Warning
Priority 6/10
Obsolete Gradle Dependency
../../build.gradle:37:
34 35 dependencies { 36 implementation 'androidx.appcompat:appcompat:1.6.1' 37 implementation 'com.google.android.material:material:1.9.0' 38 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 39 40 // CameraX../../build.gradle:42:
39 40 // CameraX 41 def camerax_version = "1.2.3" 42 implementation "androidx.camera:camera-core:${camerax_version}" 43 implementation "androidx.camera:camera-camera2:${camerax_version}" 44 implementation "androidx.camera:camera-lifecycle:${camerax_version}" 45 implementation "androidx.camera:camera-view:${camerax_version}"../../build.gradle:43:
40 // CameraX 41 def camerax_version = "1.2.3" 42 implementation "androidx.camera:camera-core:${camerax_version}" 43 implementation "androidx.camera:camera-camera2:${camerax_version}" 44 implementation "androidx.camera:camera-lifecycle:${camerax_version}" 45 implementation "androidx.camera:camera-view:${camerax_version}" 46../../build.gradle:44:
41 def camerax_version = "1.2.3" 42 implementation "androidx.camera:camera-core:${camerax_version}" 43 implementation "androidx.camera:camera-camera2:${camerax_version}" 44 implementation "androidx.camera:camera-lifecycle:${camerax_version}" 45 implementation "androidx.camera:camera-view:${camerax_version}" 46 47 // ML Kit for barcode scanning../../build.gradle:45:
42 implementation "androidx.camera:camera-core:${camerax_version}" 43 implementation "androidx.camera:camera-camera2:${camerax_version}" 44 implementation "androidx.camera:camera-lifecycle:${camerax_version}" 45 implementation "androidx.camera:camera-view:${camerax_version}" 46 47 // ML Kit for barcode scanning 48 implementation 'com.google.mlkit:barcode-scanning:17.1.0'../../build.gradle:48:
45 implementation "androidx.camera:camera-view:${camerax_version}" 46 47 // ML Kit for barcode scanning 48 implementation 'com.google.mlkit:barcode-scanning:17.1.0' 49 50 // Guava for ListenableFuture 51 implementation 'com.google.guava:guava:31.1-android'
GradleDependency
Correctness
Warning
Priority 4/10
Unsafe opt-in usage intended to be error-level severity
../../src/main/java/com/example/dronerecognition/RecognitionFragment.java:92:
89 90 imageAnalysis.setAnalyzer(cameraExecutor, image -> { 91 InputImage inputImage = InputImage.fromMediaImage( 92 image.getImage(), 93 image.getImageInfo().getRotationDegrees()); 94 95 scanner.process(inputImage)
Vendor: Android Open Source Project
Identifier: androidx.annotation.experimental
Feedback: https://issuetracker.google.com/issues/new?component=459778
Identifier: androidx.annotation.experimental
Feedback: https://issuetracker.google.com/issues/new?component=459778
UnsafeOptInUsageError
Correctness
Error
Priority 4/10
Permission Implies Unsupported Chrome OS Hardware
../../src/main/AndroidManifest.xml:7:
4 <uses-permission android:name="android.permission.INTERNET" /> 5 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 6 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 7 <uses-permission android:name="android.permission.CAMERA" /> 8 9 <application 10 android:allowBackup="true"
PermissionImpliesUnsupportedChromeOsHardware
Chrome OS
Correctness
Error
Priority 3/10
Unused resources
../../src/main/res/values/colors.xml:3:
1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <color name="purple_200">#FFBB86FC</color> 4 <color name="purple_500">#FF6200EE</color> 5 <color name="purple_700">#FF3700B3</color> 6 <color name="teal_200">#FF03DAC5</color>../../src/main/res/values/strings.xml:4:
1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <string name="app_name">无人机识别</string> 4 <string name="recognition">识别</string> 5 <string name="history">历史记录</string> 6 <string name="settings">设置</string> 7 </resources>../../src/main/res/values/strings.xml:5:
2 <resources> 3 <string name="app_name">无人机识别</string> 4 <string name="recognition">识别</string> 5 <string name="history">历史记录</string> 6 <string name="settings">设置</string> 7 </resources>../../src/main/res/values/strings.xml:6:
3 <string name="app_name">无人机识别</string> 4 <string name="recognition">识别</string> 5 <string name="history">历史记录</string> 6 <string name="settings">设置</string> 7 </resources>
UnusedResources
Performance
Warning
Priority 3/10
Monochrome icon is not defined
../../src/main/res/mipmap-anydpi-v26/ic_launcher.xml:2:
1 <?xml version="1.0" encoding="utf-8"?> 2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 <background android:drawable="@color/ic_launcher_background"/> 4 <foreground android:drawable="@drawable/ic_launcher_foreground"/> 5 </adaptive-icon>../../src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:2:
1 <?xml version="1.0" encoding="utf-8"?> 2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 <background android:drawable="@color/ic_launcher_background"/> 4 <foreground android:drawable="@drawable/ic_launcher_foreground"/> 5 </adaptive-icon>
MonochromeLauncherIcon
Icons
Usability
Warning
Priority 6/10
Use Autofill
../../src/main/res/layout/fragment_user.xml:16:
13 android:textStyle="bold" 14 android:layout_marginBottom="32dp"/> 15 16 <EditText 17 android:id="@+id/username_input" 18 android:layout_width="match_parent" 19 android:layout_height="wrap_content"../../src/main/res/layout/fragment_user.xml:24:
21 android:inputType="text" 22 android:layout_marginBottom="16dp"/> 23 24 <EditText 25 android:id="@+id/password_input" 26 android:layout_width="match_parent" 27 android:layout_height="wrap_content"
Autofill
Usability
Warning
Priority 3/10
Image without contentDescription
../../src/main/res/layout/fragment_map.xml:6:
3 android:layout_width="match_parent" 4 android:layout_height="match_parent"> 5 6 <ImageView 7 android:id="@+id/map_image" 8 android:layout_width="match_parent" 9 android:layout_height="match_parent"
ContentDescription
Accessibility
Warning
Priority 3/10
TextView Internationalization
../../src/main/java/com/example/dronerecognition/RecognitionFragment.java:101:
98 String rawValue = barcode.getRawValue(); 99 if (rawValue != null) { 100 requireActivity().runOnUiThread(() -> { 101 resultText.setText("识别结果: " + rawValue); 102 }); 103 } 104 }
SetTextI18n
Internationalization
Warning
Priority 6/10
Hardcoded text
../../src/main/res/menu/bottom_navigation_menu.xml:6:
3 <item 4 android:id="@+id/navigation_map" 5 android:icon="@drawable/ic_map" 6 android:title="地图" /> 7 <item 8 android:id="@+id/navigation_recognition" 9 android:icon="@drawable/ic_recognition"../../src/main/res/menu/bottom_navigation_menu.xml:10:
7 <item 8 android:id="@+id/navigation_recognition" 9 android:icon="@drawable/ic_recognition" 10 android:title="识别" /> 11 <item 12 android:id="@+id/navigation_history" 13 android:icon="@drawable/ic_history"../../src/main/res/menu/bottom_navigation_menu.xml:14:
11 <item 12 android:id="@+id/navigation_history" 13 android:icon="@drawable/ic_history" 14 android:title="历史" /> 15 <item 16 android:id="@+id/navigation_user" 17 android:icon="@drawable/ic_user"../../src/main/res/menu/bottom_navigation_menu.xml:18:
15 <item 16 android:id="@+id/navigation_user" 17 android:icon="@drawable/ic_user" 18 android:title="用户" /> 19 </menu>../../src/main/res/layout/fragment_recognition.xml:33:
30 android:layout_width="wrap_content" 31 android:layout_height="wrap_content" 32 android:layout_margin="16dp" 33 android:text="开始扫描" 34 app:layout_constraintBottom_toBottomOf="parent" 35 app:layout_constraintEnd_toEndOf="parent" 36 app:layout_constraintStart_toStartOf="parent" />+ 5 More Occurrences...
HardcodedText
Internationalization
Warning
Priority 5/10
Included Additional Checks
This card lists all the extra checks run by lint, provided from libraries,
build configuration and extra flags. This is included to help you verify
whether a particular check is included in analysis when configuring builds.
(Note that the list does not include the hundreds of built-in checks into lint,
only additional ones.)
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
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
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 https://developer.android.com/studio/write/lint.html#config
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> <!-- Ignore everything in the test source set --> <issue id="all"> <ignore path="\*/test/\*" /> </issue> <!-- 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" /> <ignore regexp="(foo|bar)\.java" /> </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 https://developer.android.com/studio/write/lint.html#config