Skip to content

Commit

Permalink
android: Fix ProGuard rules in Android apps
Browse files Browse the repository at this point in the history
Fixes grpc#2207. This is actually a workaround. Ideally users shouldn't need
to -keep classes, but it's a bit risky to fix the real issue before 1.1.
The further fix will be done as part of grpc#2633.

The interop app's build.gradle change is necessary to compile with newer
Gradle versions. The com.google.errorprone.annotations was necessary in
order to prevent annotation warnings from failing the build.
  • Loading branch information
ejona86 authored Jan 23, 2017
1 parent a4e481b commit 06c40dc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions android-interop-testing/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**
# Ignores: can't find referenced class javax.lang.model.element.Modifier
-dontwarn com.google.errorprone.annotations.**
-keep class io.grpc.internal.DnsNameResolverProvider
-keep class io.grpc.okhttp.OkHttpChannelProvider
2 changes: 1 addition & 1 deletion android-interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 4 additions & 0 deletions examples/android/helloworld/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
-dontwarn sun.misc.Unsafe
-dontwarn com.google.common.**
-dontwarn okio.**
# Ignores: can't find referenced class javax.lang.model.element.Modifier
-dontwarn com.google.errorprone.annotations.**
-keep class io.grpc.internal.DnsNameResolverProvider
-keep class io.grpc.okhttp.OkHttpChannelProvider
7 changes: 5 additions & 2 deletions examples/android/routeguide/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/google/home/rocking/Android/Sdk/tools/proguard/proguard-android.txt
# in $ANDROID_HOME/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand All @@ -12,4 +12,7 @@
-dontwarn sun.misc.Unsafe
-dontwarn com.google.common.**
-dontwarn okio.**

# Ignores: can't find referenced class javax.lang.model.element.Modifier
-dontwarn com.google.errorprone.annotations.**
-keep class io.grpc.internal.DnsNameResolverProvider
-keep class io.grpc.okhttp.OkHttpChannelProvider

0 comments on commit 06c40dc

Please sign in to comment.