Otherwise they will be removed by R8 since it cannot determine whether we are doing reflection on them.
Old issue below:
Using com.squareup.retrofit2:retrofit:2.9.0
After upgrading gradle plugin from
com.android.tools.build:gradle:4.1.3
to
com.android.tools.build:gradle:4.2.2
I'm getting following error when running with minifyEnabled true:
java.lang.IllegalArgumentException: Method return type must not include a type variable or wildcard
Here's how looks the method, which generates the error:
@FormUrlEncoded
@POST("view_ad") //NON-NLS
Call<GenericDataResponse<EmptyData>> viewAd(
@Field("session_id") String sessionId, //NON-NLS
@Field("id") int id //NON-NLS
);
public class EmptyData {
public EmptyData(){}
}
public class GenericDataResponse<T> {
@SerializedName("result") //NON-NLS
public String result;
@SerializedName("data") //NON-NLS
public T data;
@SerializedName("mess") //NON-NLS
public String[] messages;
}
In order to fix this I have to either:
- downgrade to the previous gradle plugin version
- add proguard rule: -keep class com.example.app.EmptyData
- disable proguard/r8
I've read the docs about gradle 4.2 changes and nothing seems to be related to proguard directly.
Can someone explain what's going on?
Otherwise they will be removed by R8 since it cannot determine whether we are doing reflection on them.
Old issue below:
Using com.squareup.retrofit2:retrofit:2.9.0
After upgrading gradle plugin from
to
I'm getting following error when running with minifyEnabled true:
Here's how looks the method, which generates the error:
In order to fix this I have to either:
I've read the docs about gradle 4.2 changes and nothing seems to be related to proguard directly.
Can someone explain what's going on?