Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
I attached a repro project. This is the stacktrace printed from the Retrofit error (I included the keep rules for the Kodein issue):
java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:365)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:4)
at retrofit2.Retrofit$1.invoke(Retrofit.java:7)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy1.getAllBreeds(Unknown Source)
at com.example.api.DogBreedApiImpl.getAllBreeds(DogBreedApi.kt:5)
at com.example.kodein7.MainActivity$onCreate$1.invokeSuspend(MainActivity.kt:5)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
ch...@gmail.com <ch...@gmail.com> #3
ak...@google.com <ak...@google.com>
ak...@google.com <ak...@google.com> #4
R8 fullmode will remove all attributes for classes that are not kept. Attributes and annotations can only be read by reflection and for full mode we require an explicit keep rule to keep the signatures (and other attributes).
As you point to, adding keep rules for the types in kodein will force R8 to keep the signatures.
For retrofit, you will have to keep the api classes. Interestingly, you also have to keep the kotlin.coroutines.Continuation as well. Adding the below rules fixes the issue in the sample for me (note, you should refine the keep rule for the api to only keep what is needed).
-keep class com.example.api.** { *; }
-keep class kotlin.coroutines.Continuation
I will make a pull request on retrofit to add kotlin.coroutines.Continuation
to the rules we consume.
ch...@gmail.com <ch...@gmail.com> #5
Will R8 strip the signature even if I have -keepattributes Signature
set in my rules?
If so, is there a rule that could be used to keep the signature just for the api classes?
Description
What
User experience
What type of Android issue is this?
Camera
What steps would let us observe this issue?
What did you expect to happen?
A preview of the front facing camera image should be seen.
What actually happened?
An error message was displayed and the rear camera image preview remained.
What was the effect of this issue on your device usage, such as lost time or work?
High
Additional comments
This also affects any other app that might use the front facing camera (e.g. WhatsApp, YouTube). In that case, attempting to change cameras does nothing.
When
Time and frequency
Time when bug report was triggered: Apr 4, 2025 12:15 AM GMT-04:00
How often has this happened?
Every time
Where
Component
Originating component: <not visible> (1684638)
Build and device data
- Build Number: google/felix_beta/felix:16/BP22.250221.015/13278879:user/release-keys
(Note: It is the build when sending this report. For exact build reference, please see the attached bugreport.)
Debugging information
Google Play services
com.google.android.gms
Version 251331035 (25.13.31 (260400-741637389))
System App (Updated)
Android System WebView
com.google.android.webview
Version 699813533 (134.0.6998.135)
System App (Updated)
Network operator: Mint
SIM operator: Mint
Filed by Android Beta Feedback. Version (Updated): 2.46-betterbug.external_20241023_RC01 (DOGFOOD)https://developer.android.com/preview/feedback#feedback-app .
To learn more about our feedback process, please visit