This stupid error wasted a whole day of research.
Recently I have replaced REST library Fuel
with Retrofit
and added OkHttp
logging interceptor with it's Proguard
rules. Then I removed interceptor but forgot to remove Proguard rules.
This error appeared in the next day. I couldn't build a project, even reinstalled AS. Then I built an apk
with Build > Generate Signed Bundle / APK
. There I saw warnings:
AGPBI: {"kind":"warning","text":"Missing class:
android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"The rule -keep public class *extends
androidx.versionedparcelable.VersionedParcelable {\n
\u003cinit\u003e();\n}
uses extends but actually matches
implements.","sources":[{}],"tool":"D8"} AGPBI:
{"kind":"warning","text":"Type org.conscrypt.Conscrypt
was not
found, it is required for default or static interface methods
desugaring of void
okhttp3.internal.platform.ConscryptPlatform.configureSslSocketFactory(javax.net.ssl.SSLSocketFactory)
","sources":[{"file":"C:\Users\user\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.12.0\b36f4a04584c0fb0d9af2d3401cdff8dacb1ea54\okhttp-3.12.0.jar"}],"tool":"D8"}
Then I removed unnecessary lines from Proguard. See How to resolve D8 warning: D8: Type `org.conscrypt.Conscrypt` was not found.
UPDATE
After several hours a problem disappeared even if I reverted to previous commits. Also it didn't reproduce on another PC. Android Studio is weird.
In order not to rebuild the project every time at every change in code I added this to configuration (see Android Studio not deploying changes to app).

UPDATE 2
I use Retrofit and keep all response files (JSON structures) in one package. I had to add them to proguard-rules.pro
:
-keep class com.example.data.network.model.** { *; }
If I remove this line, an application won't compile with message: "AGPBI: {"kind":"warning","text":"Missing class: android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}".