square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.87k stars 9.16k forks source link

okhttp 4.10.0 change shrinkMode to strict and Some of my image resources have been deleted #7746

Closed qiuqiang closed 1 year ago

qiuqiang commented 1 year ago

Question I have a json configuration file that references the name of an image, but after I built the apk, the image was still removed and cannot be found,Look at the resource log. gradle deleted my picture,I don't know the specific reason.But if I roll back to version 4.9.3, it's normal,Here are the key messages:

Gradle environment: Build time: 2022-08-05 21:17:56 UTC Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin: 1.6.21 Groovy: 3.0.10 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 11.0.12 (AdoptOpenJDK 11.0.12+1-202105061816) OS: Windows 10 10.0 amd64

Okhttp Version: "okhttp" : "com.squareup.okhttp3:okhttp:4.10.0", "okio" : "com.squareup.okio:okio:2.10.0",

1 json file content is (below assets): { "iconName": "uikit_selector_tab_task_checked", "nameId": "R.string.commissioning_task_management", } 2 icon is R.drawable.uikit_selector_tab_task_checked (a selector file) 3 How do I use it ? Drawable drawable= ContextCompat.getDrawable(context, context.getResources().getIdentifier("uikit_selector_tab_task_checked", "drawable", context.getPackageName())); NotFoundException occurred: NotFoundException Drawable :drawable/uikit_selector_tab_task_checked with resource ID #0x7f080ca5] 4 Why? resource log : Skipped unused resource res drawable/uikit_selector_tab_taskchecked replaced with small dummy file。 5 How to Solve this problem? (1) roll back to version 4.9.3 (2) keep the resource in keep.xml `<resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@drawable/uikit*"> ` But the second method is too difficult to maintain

yschimke commented 1 year ago

This is not something we can help with. Consider a site like stackoverflow, or report a bug for AGP?