Overview
| Correctness | |
| 2 | error GradleCompatible: Incompatible Gradle Versions |
| 1 | warning DefaultLocale: Implied default locale in case conversion |
| 3 | warning SimpleDateFormat: Implied locale in date format |
| 4 | warning GradleDependency: Obsolete Gradle Dependency |
| 2 | warning GradleDynamicVersion: Gradle Dynamic Version |
| Security | |
| 1 | warning
SetWorldReadable: File.setReadable() used to make file world-readable |
| 1 | warning
SetWorldWritable: File.setWritable() used to make file world-writable |
| Performance | |
| 5 | warning ObsoleteSdkInt: Obsolete SDK_INT Version Check |
| 2 | warning StaticFieldLeak: Static Field Leaks |
| 2 | warning UseSparseArrays: HashMap can be replaced with SparseArray |
| Usability | |
| 3 | warning ViewConstructor: Missing View constructors for XML inflation |
| Accessibility | |
| 1 | warning ClickableViewAccessibility: Accessibility in Custom Views |
| Disabled Checks (23) |
Incompatible Gradle Versions
../../build.gradle:
../../build.gradle:54:
../../build.gradle:54:
51 implementation "com.google.zxing:core:3.3.0" 52 implementation "com.drewnoakes:metadata-extractor:2.9.1" 53 implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.2')}" 54 implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}" 55 implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}" 56 implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}" 57 }
GradleCompatible
Correctness
Fatal
Priority 8/10
Implied default locale in case conversion
../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraViewManager.java:54:
51 } 52 default: 53 throw new IllegalArgumentException( 54 String.format("Unsupported command %d received by %s.", commandType, getClass().getSimpleName())); 55 } 56 }
DefaultLocale
Correctness
Warning
Priority 6/10
Implied locale in date format
../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java:777:
774 } 775 776 // Create a media file name 777 String fileName = String.format("%s", new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date())); 778 779 if (type == MEDIA_TYPE_IMAGE) { 780 fileName = String.format("IMG_%s.jpg", fileName);../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java:793:
790 791 private File getTempMediaFile(int type) { 792 try { 793 String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); 794 File outputDir = _reactContext.getCacheDir(); 795 File outputFile;../../src/main/java/org/reactnative/camera/RNCameraViewHelper.java:356:
353 textPaint.setColor(Color.YELLOW); 354 textPaint.setTextSize(35); 355 Calendar calendar = Calendar.getInstance(); 356 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd G '->' HH:mm:ss z"); 357 canvas.drawText(simpleDateFormat.format(calendar.getTime()), width * 0.1f, height * 0.2f, textPaint); 358 canvas.drawText(simpleDateFormat.format(calendar.getTime()), width * 0.2f, height * 0.4f, textPaint); 359 canvas.drawText(simpleDateFormat.format(calendar.getTime()), width * 0.3f, height * 0.6f, textPaint);
SimpleDateFormat
Correctness
Warning
Priority 6/10
Obsolete Gradle Dependency
../../build.gradle:15:
12 } 13 14 dependencies { 15 classpath 'com.android.tools.build:gradle:3.0.1' 16 } 17 }../../build.gradle:53:
50 compileOnly 'com.facebook.infer.annotation:infer-annotation:+' 51 implementation "com.google.zxing:core:3.3.0" 52 implementation "com.drewnoakes:metadata-extractor:2.9.1" 53 implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.2')}" 54 implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}" 55 implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}" 56 implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}"../../build.gradle:54:
51 implementation "com.google.zxing:core:3.3.0" 52 implementation "com.drewnoakes:metadata-extractor:2.9.1" 53 implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.2')}" 54 implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}" 55 implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}" 56 implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}" 57 }../../build.gradle:56:
53 implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.2')}" 54 implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}" 55 implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}" 56 implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}" 57 }
GradleDependency
Correctness
Warning
Priority 4/10
Gradle Dynamic Version
../../build.gradle:49:
46 } 47 48 dependencies { 49 compileOnly 'com.facebook.react:react-native:+' 50 compileOnly 'com.facebook.infer.annotation:infer-annotation:+' 51 implementation "com.google.zxing:core:3.3.0" 52 implementation "com.drewnoakes:metadata-extractor:2.9.1"../../build.gradle:50:
47 48 dependencies { 49 compileOnly 'com.facebook.react:react-native:+' 50 compileOnly 'com.facebook.infer.annotation:infer-annotation:+' 51 implementation "com.google.zxing:core:3.3.0" 52 implementation "com.drewnoakes:metadata-extractor:2.9.1" 53 implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.2')}"
GradleDynamicVersion
Correctness
Warning
Priority 4/10
File.setReadable() used to make file world-readable
../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java:430:
427 return; 428 } 429 430 f.setReadable(true, false); // so mediaplayer can play it 431 f.setWritable(true, false); // so can clean it up 432 433 WritableMap response = new WritableNativeMap();
SetWorldReadable
Security
Warning
Priority 6/10
File.setWritable() used to make file world-writable
../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraModule.java:431:
428 } 429 430 f.setReadable(true, false); // so mediaplayer can play it 431 f.setWritable(true, false); // so can clean it up 432 433 WritableMap response = new WritableNativeMap(); 434 switch (mRecordingOptions.getInt("target")) {
SetWorldWritable
Security
Warning
Priority 6/10
Obsolete SDK_INT Version Check
../../src/main/java/com/google/android/cameraview/Camera1.java:176:
173 if (mPreviewTexture != null) { 174 mCamera.setPreviewTexture(mPreviewTexture); 175 } else if (mPreview.getOutputClass() == SurfaceHolder.class) { 176 final boolean needsToStopPreview = mShowingPreview && Build.VERSION.SDK_INT < 14; 177 if (needsToStopPreview) { 178 mCamera.stopPreview(); 179 mIsPreviewActive = false;../../src/main/java/com/google/android/cameraview/Camera1.java:509:
506 } 507 mDisplayOrientation = displayOrientation; 508 if (isCameraOpened()) { 509 final boolean needsToStopPreview = mShowingPreview && Build.VERSION.SDK_INT < 14; 510 if (needsToStopPreview) { 511 mCamera.stopPreview(); 512 mIsPreviewActive = false;../../src/main/java/com/google/android/cameraview/CameraView.java:132:
129 @NonNull 130 private PreviewImpl createPreviewImpl(Context context) { 131 PreviewImpl preview; 132 if (Build.VERSION.SDK_INT < 14) { 133 preview = new SurfaceViewPreview(context, this); 134 } else { 135 preview = new TextureViewPreview(context, this);../../src/main/java/org/reactnative/camera/RNCameraView.java:96:
93 promise.resolve(null); 94 } 95 final File cacheDirectory = mPictureTakenDirectories.remove(promise); 96 if(Build.VERSION.SDK_INT >= 11/*HONEYCOMB*/) { 97 new ResolveTakenPictureAsyncTask(data, promise, options, cacheDirectory, deviceOrientation, RNCameraView.this) 98 .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); 99 } else {../../src/main/res/layout-v14:
ObsoleteSdkInt
Performance
Warning
Priority 6/10
Static Field Leaks
../../src/main/java/org/reactnative/facedetector/tasks/FileFaceDetectionAsyncTask.java:38:
35 private Promise mPromise; 36 private int mWidth = 0; 37 private int mHeight = 0; 38 private Context mContext; 39 private ReadableMap mOptions; 40 private int mOrientation = ExifInterface.ORIENTATION_UNDEFINED; 41 private RNFaceDetector mRNFaceDetector;../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraViewFinder.java:326:
323 } 324 } 325 326 private class ReaderAsyncTask extends AsyncTask<Void, Void, Void> { 327 private byte[] imageData; 328 private final Camera camera;
StaticFieldLeak
Performance
Warning
Priority 6/10
HashMap can be replaced with SparseArray
../../src/main/java/com/lwansbrough/RCTCamera/RCTCamera.java:466:
463 464 private RCTCamera(int deviceOrientation) { 465 _cameras = new HashMap<>(); 466 _cameraInfos = new HashMap<>(); 467 _cameraTypeToIndex = new HashMap<>(); 468 469 _actualDeviceOrientation = deviceOrientation;../../src/main/java/com/lwansbrough/RCTCamera/RCTCamera.java:467:
464 private RCTCamera(int deviceOrientation) { 465 _cameras = new HashMap<>(); 466 _cameraInfos = new HashMap<>(); 467 _cameraTypeToIndex = new HashMap<>(); 468 469 _actualDeviceOrientation = deviceOrientation;
UseSparseArrays
Performance
Warning
Priority 4/10
Missing View constructors for XML inflation
../../src/main/java/com/google/android/cameraview/CameraView.java:44:
41 import java.util.Set; 42 import java.util.SortedSet; 43 44 public class CameraView extends FrameLayout { 45 46 /** The camera device faces the opposite direction as the device's screen. */ 47 public static final int FACING_BACK = Constants.FACING_BACK;../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraViewFinder.java:37:
34 import com.google.zxing.ResultPoint; 35 import com.google.zxing.common.HybridBinarizer; 36 37 class RCTCameraViewFinder extends TextureView implements TextureView.SurfaceTextureListener, Camera.PreviewCallback { 38 private int _cameraType; 39 private int _captureMode; 40 private SurfaceTexture _surfaceTexture;../../src/main/java/org/reactnative/camera/RNCameraView.java:37:
34 import java.util.concurrent.ConcurrentHashMap; 35 import java.util.concurrent.ConcurrentLinkedQueue; 36 37 public class RNCameraView extends CameraView implements LifecycleEventListener, BarCodeScannerAsyncTaskDelegate, FaceDetectorAsyncTaskDelegate, 38 BarcodeDetectorAsyncTaskDelegate, TextRecognizerAsyncTaskDelegate, PictureSavedDelegate { 39 private ThemedReactContext mThemedReactContext; 40 private Queue<Promise> mPictureTakenPromises = new ConcurrentLinkedQueue<>();
ViewConstructor
Usability
Warning
Priority 3/10
Accessibility in Custom Views
../../src/main/java/com/lwansbrough/RCTCamera/RCTCameraViewFinder.java:421:
418 } 419 420 @Override 421 public boolean onTouchEvent(MotionEvent event) { 422 // Fast swiping and touching while component is being loaded can cause _camera to be null. 423 if (_camera == null) { 424 return false;
ClickableViewAccessibility
Accessibility
Warning
Priority 6/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>
<!-- 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:
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>
<!-- 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/pathFor more information, see http://g.co/androidstudio/suppressing-lint-warnings