未验证 提交 8b8887c1 编写于 作者: J Jesse Wilson 提交者: GitHub

Merge pull request #2787 from square/jakew/ship-rules/2018-06-11

Ship R8/ProGuard rules in the jar.
......@@ -27,22 +27,13 @@ Snapshots of the development version are available in [Sonatype's `snapshots` re
Retrofit requires at minimum Java 7 or Android 2.3.
ProGuard
--------
R8 / ProGuard
-------------
If you are using ProGuard you need to add the following options:
```
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain service method parameters.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
```
If you are using R8 or ProGuard add the options from
[this file](https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/rules.pro).
You might also need rules for OkHttp and Okio which are dependencies.
You might also need rules for OkHttp and Okio which are dependencies of this library.
License
......
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain service method parameters.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
......@@ -173,19 +173,9 @@ implementation 'com.squareup.retrofit2:retrofit:<span class="version pln"><em>(i
</pre>
<p>Retrofit requires at minimum Java 7 or Android 2.3.</p>
<h4>ProGuard</h4>
<p>If you are using ProGuard in your project add the following lines to your configuration:</p>
<pre class="prettyprint">
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain service method parameters.
-keepclassmembernames,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
</pre>
<p>Retrofit uses <a href="https://github.com/square/okio">Okio</a> under the hood, so you may want to look at its <a href="https://github.com/square/okio#proguard">ProGuard rules</a> as well.</p>
<h4>R8 / ProGuard</h4>
<p>If you are using R8 or ProGuard add the options from <a href="https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/rules.pro">this file</a>.</p>
<p>You might also need rules for OkHttp and Okio which are dependencies of this library.</p>
</section>
<section id="contributing">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册