Retrofit 2 not sending data when ProGuard is enabled
<p>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 anymore. (See log outputs)</p>

<p>Sample code :</p>

<p>User Model :</p>

<pre class="lang-java prettyprint-override"><code>public interface UserService {

    @GET(GET_LOGIN)
    Observable&lt;User&gt; login(@Header("Authorization") String basic);
}
</code></pre>

<p>Login Activity :</p>

<pre class="lang-java prettyprint-override"><code>public void onClick(View v) {
    mRetrofit.create(UserService.class)
             .login(Credentials.basic(email, password))
             .subscribeOn(Schedulers.io())
             .observeOn(AndroidSchedulers.mainThread())
             .subscribe(user -&gt; {
                UserHelper.save(LoginActivity.this, user);
             }, throwable -&gt; Dog.d);
}
</code></pre>

<p>Proguard File :</p>

<pre class="lang-none prettyprint-override"><code># Retrofit
-dontwarn retrofit2.** 
-dontwarn org.codehaus.mojo.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
-keepclasseswithmembers class * {
    @retrofit.* &lt;methods&gt;;
}

-keepclasseswithmembers interface * {
    @retrofit.* &lt;methods&gt;;
}
</code></pre>

<p>Logs (proguard) :</p>

<pre class="lang-none prettyprint-override"><code>D/OkHttp: --&gt; GET http://passport-supercairos.rhcloud.com/users/login HTTP/1.1
D/OkHttp: User-Agent: VirtualPassport-Client {Android-23} {Aquaris_E5}
D/OkHttp: Cache-Control: max-stale=10800
D/OkHttp: --&gt; END GET
D/OkHttp: &lt;-- HTTP/1.1 401 Unauthorized (258ms)
D/OkHttp: Date: Fri, 19 Feb 2016 12:57:19 GMT
D/OkHttp: X-Powered-By: Express
D/OkHttp: WWW-Authenticate: Basic realm="Users"
D/OkHttp: Keep-Alive: timeout=15, max=100
D/OkHttp: Connection: Keep-Alive
D/OkHttp: Transfer-Encoding: chunked
D/OkHttp: Content-Type: text/plain
D/OkHttp: OkHttp-Sent-Millis: 1455886639681
D/OkHttp: OkHttp-Received-Millis: 1455886639787
D/OkHttp: Unauthorized
D/OkHttp: &lt;-- END HTTP (12-byte body)
</code></pre>

<p>Logs (non-proguard) :</p>

<pre class="lang-none prettyprint-override"><code>D/OkHttp: --&gt; GET http://passport-supercairos.rhcloud.com/users/login HTTP/1.1
D/OkHttp: User-Agent: VirtualPassport-Client {Android-23} {Aquaris_E5}
D/OkHttp: Cache-Control: max-stale=10800
D/OkHttp: Authorization: Basic ZG9yb2ZyanVAZ21haWwuY29tOmN2dnZ2dnY=
D/OkHttp: --&gt; END GET
D/OkHttp: &lt;-- HTTP/1.1 401 Unauthorized (258ms)
D/OkHttp: Date: Fri, 19 Feb 2016 12:57:19 GMT
D/OkHttp: X-Powered-By: Express
D/OkHttp: WWW-Authenticate: Basic realm="Users"
D/OkHttp: Keep-Alive: timeout=15, max=100
D/OkHttp: Connection: Keep-Alive
D/OkHttp: Transfer-Encoding: chunked
D/OkHttp: Content-Type: text/plain
D/OkHttp: OkHttp-Sent-Millis: 1455886639681
D/OkHttp: OkHttp-Received-Millis: 1455886639787
D/OkHttp: Unauthorized
D/OkHttp: &lt;-- END HTTP (12-byte body)
</code></pre>

<p>Full code can be found here : <a href="https://github.com/supercairos/virtual-passport">https://github.com/supercairos/virtual-passport</a></p>