Overview
| Correctness | |
| 7 | warning DefaultLocale: Implied default locale in case conversion |
| 1 | warning OldTargetApi: Target SDK attribute is not targeting latest version |
| 1 | warning FragmentTagUsage: Use FragmentContainerView instead of the <fragment> tag |
| 2 | warning IntentFilterUniqueDataAttributes: Data tags should only declare unique attributes |
| 15 | warning GradleDependency: Obsolete Gradle Dependency |
| 3 | warning NewerVersionAvailable: Newer Library Versions Available |
| 3 | warning DiscouragedApi: Using discouraged APIs |
| Performance | |
| 5 | warning NotifyDataSetChanged: Invalidating All RecyclerView Data |
| 1 | warning ObsoleteSdkInt: Obsolete SDK_INT Version Check |
| 1 | warning
DisableBaselineAlignment: Missing baselineAligned attribute |
| 5 | warning Overdraw: Overdraw: Painting regions more than once |
| 8 | warning UnusedResources: Unused resources |
| 1 | warning UselessParent: Unnecessary parent layout |
| Usability:Icons | |
| 1 | warning MonochromeLauncherIcon: Monochrome icon is not defined |
| 1 | warning IconLocation: Image defined in density-independent drawable folder |
| Accessibility | |
| 3 | warning
ContentDescription: Image without contentDescription |
| 2 | warning LabelFor: Missing accessibility label |
| Internationalization | |
| 23 | warning SetTextI18n: TextView Internationalization |
| 72 | warning HardcodedText: Hardcoded text |
| Included Additional Checks (31) | |
| Disabled Checks (40) |
Implied default locale in case conversion
../../src/main/java/com/example/cuida/ui/medication/MedicationDialog.java:351:
348 return; 349 } 350 351 String lowerQuery = query.toLowerCase(); 352 for (Comprimido p : fullPillsList) { 353 if (p.nome != null && p.nome.toLowerCase().contains(lowerQuery)) { 354 searchResults.add(p);../../src/main/java/com/example/cuida/ui/medication/MedicationDialog.java:353:
350 351 String lowerQuery = query.toLowerCase(); 352 for (Comprimido p : fullPillsList) { 353 if (p.nome != null && p.nome.toLowerCase().contains(lowerQuery)) { 354 searchResults.add(p); 355 } 356 }../../src/main/java/com/example/cuida/ui/schedule/ScheduleAppointmentFragment.java:82:
79 } 80 81 private boolean isUrgentSymptom(String reason) { 82 String lowerReason = reason.toLowerCase(); 83 String[] urgentKeywords = { 84 "dor no peito", "falta de ar", "desmaio", "sangramento", 85 "paralisia", "perda de vis", "dormência", "confusão",../../src/main/java/com/example/cuida/ui/schedule/ScheduleViewModel.java:80:
77 } 78 79 public void setDate(int year, int month, int dayOfMonth) { 80 String date = String.format("%02d/%02d/%04d", dayOfMonth, month + 1, year); 81 selectedDate.setValue(date); 82 loadTimeSlots(date); 83 }../../src/main/java/com/example/cuida/ui/schedule/ScheduleViewModel.java:187:
184 boolean isToday = false; 185 186 if (selectedDateStr != null) { 187 String todayStr = String.format("%02d/%02d/%04d", 188 now.get(Calendar.DAY_OF_MONTH), 189 now.get(Calendar.MONTH) + 1, 190 now.get(Calendar.YEAR));../../src/main/java/com/example/cuida/ui/schedule/ScheduleViewModel.java:201:
198 199 for (int hour = startHour; hour <= endHour; hour++) { 200 if (!isToday || hour > currentHour || (hour == currentHour && 0 > currentMinute)) { 201 addSlot(slots, String.format("%02d:00", hour), bookedTimes); 202 } 203 if (hour != endHour) { 204 if (!isToday || hour > currentHour || (hour == currentHour && 30 > currentMinute)) {../../src/main/java/com/example/cuida/ui/schedule/ScheduleViewModel.java:205:
202 } 203 if (hour != endHour) { 204 if (!isToday || hour > currentHour || (hour == currentHour && 30 > currentMinute)) { 205 addSlot(slots, String.format("%02d:30", hour), bookedTimes); 206 } 207 } 208 }
DefaultLocale
Correctness
Warning
Priority 6/10
Target SDK attribute is not targeting latest version
../../build.gradle:13:
10 defaultConfig { 11 applicationId "com.example.cuida" 12 minSdk 24 13 targetSdk 35 14 versionCode 1 15 versionName "1.0"
OldTargetApi
Correctness
Warning
Priority 6/10
Use FragmentContainerView instead of the <fragment> tag
../../src/main/res/layout/activity_main.xml:9:
6 android:layout_height="match_parent" 7 tools:context=".MainActivity"> 8 9 <fragment 10 android:id="@+id/nav_host_fragment" 11 android:name="androidx.navigation.fragment.NavHostFragment" 12 android:layout_width="0dp"
Vendor: Android Open Source Project
Identifier: androidx.fragment
Feedback: https://issuetracker.google.com/issues/new?component=460964
Identifier: androidx.fragment
Feedback: https://issuetracker.google.com/issues/new?component=460964
FragmentTagUsage
Correctness
Warning
Priority 5/10
Data tags should only declare unique attributes
../../src/main/AndroidManifest.xml:53:
50 <category android:name="android.intent.category.BROWSABLE" /> 51 <!-- Update the host to match your Firebase project's hosting domain 52 or the custom domain you configured for dynamic links --> 53 <data 54 android:scheme="https" 55 android:host="papcuida.page.link" /> 56 <data../../src/main/AndroidManifest.xml:56:
53 <data 54 android:scheme="https" 55 android:host="papcuida.page.link" /> 56 <data 57 android:scheme="cuida" 58 android:host="resetpassword" /> 59 </intent-filter>
IntentFilterUniqueDataAttributes
Correctness
Warning
Priority 5/10
Obsolete Gradle Dependency
../../build.gradle:8:
5 6 android { 7 namespace 'com.example.cuida' 8 compileSdk 35 9 10 defaultConfig { 11 applicationId "com.example.cuida"../../build.gradle:39:
36 } 37 38 dependencies { 39 implementation 'androidx.appcompat:appcompat:1.6.1' 40 implementation 'com.google.ai.client.generativeai:generativeai:0.9.0' 41 implementation 'com.google.android.material:material:1.11.0' 42 implementation 'androidx.constraintlayout:constraintlayout:2.1.4'../../build.gradle:41:
38 dependencies { 39 implementation 'androidx.appcompat:appcompat:1.6.1' 40 implementation 'com.google.ai.client.generativeai:generativeai:0.9.0' 41 implementation 'com.google.android.material:material:1.11.0' 42 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 43 implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0' 44 implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'../../build.gradle:42:
39 implementation 'androidx.appcompat:appcompat:1.6.1' 40 implementation 'com.google.ai.client.generativeai:generativeai:0.9.0' 41 implementation 'com.google.android.material:material:1.11.0' 42 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 43 implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0' 44 implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0' 45 implementation 'androidx.navigation:navigation-fragment:2.7.7'../../build.gradle:43:
40 implementation 'com.google.ai.client.generativeai:generativeai:0.9.0' 41 implementation 'com.google.android.material:material:1.11.0' 42 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 43 implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0' 44 implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0' 45 implementation 'androidx.navigation:navigation-fragment:2.7.7' 46 implementation 'androidx.navigation:navigation-ui:2.7.7'+ 10 More Occurrences...
GradleDependency
Correctness
Warning
Priority 4/10
Newer Library Versions Available
../../build.gradle:64:
61 implementation 'com.google.android.gms:play-services-location:21.0.1' 62 63 // Para chamadas de rede e JSON (Nova solução oficial de comunicação com a IA) 64 implementation 'com.squareup.retrofit2:retrofit:2.9.0' 65 implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 66 implementation 'com.squareup.okhttp3:okhttp:4.10.0'../../build.gradle:65:
62 63 // Para chamadas de rede e JSON (Nova solução oficial de comunicação com a IA) 64 implementation 'com.squareup.retrofit2:retrofit:2.9.0' 65 implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 66 implementation 'com.squareup.okhttp3:okhttp:4.10.0' 67 68 // Firebase BoM../../build.gradle:66:
63 // Para chamadas de rede e JSON (Nova solução oficial de comunicação com a IA) 64 implementation 'com.squareup.retrofit2:retrofit:2.9.0' 65 implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 66 implementation 'com.squareup.okhttp3:okhttp:4.10.0' 67 68 // Firebase BoM 69 implementation platform('com.google.firebase:firebase-bom:32.7.2')
NewerVersionAvailable
Correctness
Warning
Priority 4/10
Using discouraged APIs
../../src/main/java/com/example/cuida/ui/schedule/ScheduleAppointmentFragment.java:140:
137 datePicker.setMinDate(System.currentTimeMillis() - 1000); 138 139 // Hide the year component 140 int yearSpinnerId = android.content.res.Resources.getSystem().getIdentifier("year", "id", "android"); 141 if (yearSpinnerId != 0) { 142 View yearSpinner = datePicker.findViewById(yearSpinnerId); 143 if (yearSpinner != null) {../../src/main/java/com/example/cuida/ui/schedule/ScheduleAppointmentFragment.java:149:
146 } 147 148 // Put day on left, month on right 149 int daySpinnerId = android.content.res.Resources.getSystem().getIdentifier("day", "id", "android"); 150 int monthSpinnerId = android.content.res.Resources.getSystem().getIdentifier("month", "id", "android"); 151 if (daySpinnerId != 0 && monthSpinnerId != 0) { 152 View daySpinner = datePicker.findViewById(daySpinnerId);../../src/main/java/com/example/cuida/ui/schedule/ScheduleAppointmentFragment.java:150:
147 148 // Put day on left, month on right 149 int daySpinnerId = android.content.res.Resources.getSystem().getIdentifier("day", "id", "android"); 150 int monthSpinnerId = android.content.res.Resources.getSystem().getIdentifier("month", "id", "android"); 151 if (daySpinnerId != 0 && monthSpinnerId != 0) { 152 View daySpinner = datePicker.findViewById(daySpinnerId); 153 View monthSpinner = datePicker.findViewById(monthSpinnerId);
DiscouragedApi
Correctness
Warning
Priority 2/10
Invalidating All RecyclerView Data
../../src/main/java/com/example/cuida/ui/appointments/AppointmentAdapter.java:20:
17 18 public void setAppointments(List<Appointment> appointments) { 19 this.appointmentList = appointments; 20 notifyDataSetChanged(); 21 } 22 23 @NonNull../../src/main/java/com/example/cuida/ui/medication/MedicationAdapter.java:32:
29 30 public void setMedications(List<Medication> medications) { 31 this.medicationList = medications; 32 notifyDataSetChanged(); 33 } 34 35 @NonNull../../src/main/java/com/example/cuida/ui/medication/MedicationDialog.java:347:
344 searchResults.clear(); 345 if (query.isEmpty()) { 346 recyclerResults.setVisibility(View.GONE); 347 recyclerAdapter.notifyDataSetChanged(); 348 return; 349 }../../src/main/java/com/example/cuida/ui/medication/MedicationDialog.java:358:
355 } 356 } 357 358 recyclerAdapter.notifyDataSetChanged(); 359 recyclerResults.setVisibility(searchResults.isEmpty() ? View.GONE : View.VISIBLE); 360 }../../src/main/java/com/example/cuida/ui/schedule/TimeSlotAdapter.java:28:
25 26 public void setTimeSlots(List<TimeSlot> slots) { 27 this.timeSlots = slots; 28 notifyDataSetChanged(); 29 } 30 31 @NonNull
NotifyDataSetChanged
Performance
Warning
Priority 8/10
Obsolete SDK_INT Version Check
../../src/main/java/com/example/cuida/utils/AlarmScheduler.java:36:
33 // Fallback to inexact alarm if exact permission is revoked 34 alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent); 35 } 36 } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 37 alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent); 38 } else { 39 alarmManager.setExact(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
ObsoleteSdkInt
Performance
Warning
Priority 6/10
Missing baselineAligned attribute
../../src/main/res/layout/activity_register.xml:59:
56 android:inputType="textPersonName" /> 57 </com.google.android.material.textfield.TextInputLayout> 58 59 <LinearLayout 60 android:layout_width="match_parent" 61 android:layout_height="wrap_content" 62 android:orientation="horizontal">
DisableBaselineAlignment
Performance
Warning
Priority 3/10
Overdraw: Painting regions more than once
../../src/main/res/layout/activity_forgot_password.xml:8:
5 android:orientation="vertical" 6 android:gravity="center" 7 android:padding="24dp" 8 android:background="@color/background_color"> 9 10 <ImageView 11 android:layout_width="187dp"../../src/main/res/layout/activity_login.xml:7:
4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:fillViewport="true" 7 android:background="@color/background_color"> 8 9 <LinearLayout 10 android:layout_width="match_parent"../../src/main/res/layout/activity_register.xml:7:
4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:fillViewport="true" 7 android:background="@color/background_color"> 8 9 <LinearLayout 10 android:layout_width="match_parent"../../src/main/res/layout/activity_reset_password.xml:8:
5 android:orientation="vertical" 6 android:gravity="center" 7 android:padding="24dp" 8 android:background="@color/background_color"> 9 10 <ImageView 11 android:layout_width="187dp"../../src/main/res/layout/fragment_profile.xml:9:
6 android:orientation="vertical" 7 android:padding="24dp" 8 android:gravity="center_horizontal" 9 android:background="@color/background_color"> 10 11 <com.google.android.material.imageview.ShapeableImageView 12 android:id="@+id/profile_image"
Overdraw
Performance
Warning
Priority 3/10
Unused resources
../../src/main/res/drawable/bg_search_results.xml:2:
1 <?xml version="1.0" encoding="utf-8"?> 2 <shape xmlns:android="http://schemas.android.com/apk/res/android"> 3 <solid android:color="#FFFFFF" /> 4 <stroke android:width="1dp" android:color="#DDDDDD" /> 5 <corners android:radius="8dp" />../../src/main/res/values/colors.xml:5:
2 <resources> 3 <!-- App Brand Colors --> 4 <color name="primary_color">#0066CC</color> <!-- Modern Medical Blue --> 5 <color name="primary_light_color">#E3F2FD</color> 6 <color name="primary_dark_color">#004C99</color> 7 <color name="secondary_color">#000000</color> <!-- Black --> 8 <color name="secondary_dark_color">#000000</color>../../src/main/res/values/colors.xml:18:
15 <color name="error_color">#B00020</color> 16 17 <!-- Standard overrides --> 18 <color name="purple_200">#90CAF9</color> 19 <color name="purple_500">#0066CC</color> 20 <color name="purple_700">#004C99</color> 21 <color name="teal_200">#69F0AE</color>../../src/main/res/values/colors.xml:19:
16 17 <!-- Standard overrides --> 18 <color name="purple_200">#90CAF9</color> 19 <color name="purple_500">#0066CC</color> 20 <color name="purple_700">#004C99</color> 21 <color name="teal_200">#69F0AE</color> 22 <color name="teal_700">#000000</color>../../src/main/res/values/colors.xml:20:
17 <!-- Standard overrides --> 18 <color name="purple_200">#90CAF9</color> 19 <color name="purple_500">#0066CC</color> 20 <color name="purple_700">#004C99</color> 21 <color name="teal_200">#69F0AE</color> 22 <color name="teal_700">#000000</color> 23 <color name="black">#000000</color>../../src/main/res/values/colors.xml:21:
18 <color name="purple_200">#90CAF9</color> 19 <color name="purple_500">#0066CC</color> 20 <color name="purple_700">#004C99</color> 21 <color name="teal_200">#69F0AE</color> 22 <color name="teal_700">#000000</color> 23 <color name="black">#000000</color> 24 <color name="white">#FFFFFF</color>../../src/main/res/drawable/ic_launcher.xml:1:
1 <vector xmlns:android="http://schemas.android.com/apk/res/android" 2 android:width="108dp" 3 android:height="108dp" 4 android:viewportWidth="108"../../src/main/res/drawable/ic_launcher_round.xml:1:
1 <vector xmlns:android="http://schemas.android.com/apk/res/android" 2 android:width="108dp" 3 android:height="108dp" 4 android:viewportWidth="108"
UnusedResources
Performance
Warning
Priority 3/10
Unnecessary parent layout
../../src/main/res/layout/fragment_appointments.xml:6:
3 android:layout_width="match_parent" 4 android:layout_height="match_parent"> 5 6 <LinearLayout 7 android:layout_width="match_parent" 8 android:layout_height="match_parent" 9 android:orientation="vertical"
UselessParent
Performance
Warning
Priority 2/10
Monochrome icon is not defined
../../src/main/res/drawable-v26/ic_launcher_final.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="@android:color/white" /> 4 <foreground android:drawable="@drawable/ic_logo_scaled" /> 5 </adaptive-icon>
MonochromeLauncherIcon
Icons
Usability
Warning
Priority 6/10
Image defined in density-independent drawable folder
IconLocation
Icons
Usability
Warning
Priority 5/10
Image without contentDescription
../../src/main/res/layout/activity_forgot_password.xml:10:
7 android:padding="24dp" 8 android:background="@color/background_color"> 9 10 <ImageView 11 android:layout_width="187dp" 12 android:layout_height="177dp" 13 android:layout_marginBottom="24dp"../../src/main/res/layout/activity_reset_password.xml:10:
7 android:padding="24dp" 8 android:background="@color/background_color"> 9 10 <ImageView 11 android:layout_width="187dp" 12 android:layout_height="177dp" 13 android:layout_marginBottom="24dp"../../src/main/res/layout/item_medication.xml:20:
17 android:padding="16dp" 18 android:gravity="center_vertical"> 19 20 <ImageView 21 android:layout_width="40dp" 22 android:layout_height="40dp" 23 android:src="@android:drawable/ic_menu_agenda"
ContentDescription
Accessibility
Warning
Priority 3/10
Missing accessibility label
../../src/main/res/layout/activity_register.xml:105:
102 android:layout_marginBottom="16dp" 103 android:hint="Sexo"> 104 105 <AutoCompleteTextView 106 android:id="@+id/gender_auto_complete" 107 android:layout_width="match_parent" 108 android:layout_height="wrap_content"../../src/main/res/layout/fragment_schedule_appointment.xml:64:
61 android:layout_marginBottom="16dp" 62 android:hint="Escolha o médico"> 63 64 <AutoCompleteTextView 65 android:id="@+id/spinner_doctor" 66 android:layout_width="match_parent" 67 android:layout_height="wrap_content"
LabelFor
Accessibility
Warning
Priority 2/10
TextView Internationalization
../../src/main/java/com/example/cuida/ui/appointments/AppointmentAdapter.java:36:
33 holder.textType.setText(appointment.type); 34 holder.textDate.setText(appointment.date); 35 holder.textTime.setText(appointment.time); 36 holder.textReason.setText("Motivo: " + (appointment.reason != null ? appointment.reason : "--")); 37 38 String status = appointment.status != null ? appointment.status : "Pendente"; 39 holder.textStatus.setText(status);../../src/main/java/com/example/cuida/ui/appointments/AppointmentAdapter.java:36:
33 holder.textType.setText(appointment.type); 34 holder.textDate.setText(appointment.date); 35 holder.textTime.setText(appointment.time); 36 holder.textReason.setText("Motivo: " + (appointment.reason != null ? appointment.reason : "--")); 37 38 String status = appointment.status != null ? appointment.status : "Pendente"; 39 holder.textStatus.setText(status);../../src/main/java/com/example/cuida/ui/appointments/AppointmentAdapter.java:50:
47 } else { 48 holder.textStatus.setTextColor(android.graphics.Color.parseColor("#F57C00")); // Orange 49 holder.textStatus.setBackgroundColor(android.graphics.Color.parseColor("#FFE0B2")); 50 holder.textStatus.setText("Pendente"); 51 } 52 }../../src/main/java/com/example/cuida/ui/home/HomeFragment.java:44:
41 if (name != null && !name.isEmpty()) { 42 // Extract first name 43 String firstName = name.split(" ")[0]; 44 binding.textGreeting.setText("Olá, " + firstName + "!"); 45 } else { 46 binding.textGreeting.setText("Olá, Utilizador!"); 47 }../../src/main/java/com/example/cuida/ui/home/HomeFragment.java:44:
41 if (name != null && !name.isEmpty()) { 42 // Extract first name 43 String firstName = name.split(" ")[0]; 44 binding.textGreeting.setText("Olá, " + firstName + "!"); 45 } else { 46 binding.textGreeting.setText("Olá, Utilizador!"); 47 }+ 18 More Occurrences...
SetTextI18n
Internationalization
Warning
Priority 6/10
Hardcoded text
../../src/main/res/layout/activity_forgot_password.xml:29:
26 <TextView 27 android:layout_width="wrap_content" 28 android:layout_height="wrap_content" 29 android:text="Insira o seu email para recuperar a palavra-passe." 30 android:gravity="center" 31 android:textSize="16sp" 32 android:layout_marginBottom="32dp"/>../../src/main/res/layout/activity_forgot_password.xml:51:
48 android:id="@+id/reset_button" 49 android:layout_width="match_parent" 50 android:layout_height="56dp" 51 android:text="Recuperar Palavra-passe" 52 android:textSize="16sp" 53 android:layout_marginBottom="16dp"/>../../src/main/res/layout/activity_forgot_password.xml:59:
56 android:id="@+id/back_to_login" 57 android:layout_width="wrap_content" 58 android:layout_height="wrap_content" 59 android:text="Voltar ao Login" 60 android:textColor="@color/primary_color" 61 android:textStyle="bold"/>../../src/main/res/layout/activity_login.xml:78:
75 android:id="@+id/checkbox_remember_me" 76 android:layout_width="wrap_content" 77 android:layout_height="wrap_content" 78 android:text="Lembrar-me" 79 android:layout_gravity="start" 80 android:layout_marginBottom="16dp"/>../../src/main/res/layout/activity_login.xml:96:
93 style="@style/Widget.MaterialComponents.Button.TextButton" 94 android:layout_width="match_parent" 95 android:layout_height="wrap_content" 96 android:text="Login com Biometria" 97 android:icon="@android:drawable/ic_dialog_info" 98 android:layout_marginBottom="16dp" 99 android:visibility="gone"/>+ 67 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/pathFor more information, see https://developer.android.com/studio/write/lint.html#config
