Retrofit 2 not sending data when ProGuard is enabled

前端 未结 7 1156
抹茶落季
抹茶落季 2020-12-30 00:43

I try to login my users using Retrofit 2. (Basically a GET to the login URL with a basic header) It works well but once I ProGuard it, the Header Authorization is not sent a

7条回答
  •  醉酒成梦
    2020-12-30 01:24

    Another simple solution use @keep from support annotation https://developer.android.com/reference/android/support/annotation/Keep.html

    @Keep
    interface APIService 
    {
    
        @GET("/user/auth")
        fun auth(@Header(Constants.AUTHORIZATION) authorization: String): Call
    
    }
    

提交回复
热议问题