Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
Configure proguard for Dexter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Gutierrez committed May 22, 2017
1 parent 89fd861 commit b0ca5d3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/build
/captures
**.iml
/.idea
/.idea
*.apk
10 changes: 7 additions & 3 deletions dexter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ android {
versionName "1.0"
}
buildTypes {
release {
debug {
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
testCompile 'org.mockito:mockito-core:1.9.5'
}
10 changes: 10 additions & 0 deletions dexter/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-renamesourcefileattribute SourceFile

# Preserve all Dexter classes and method names

-keepattributes InnerClasses, Signature, *Annotation*

-keep class com.karumi.dexter.** { *; }
-keep interface com.karumi.dexter.** { *; }
-keepclasseswithmembernames class com.karumi.dexter.** { *; }
-keepclasseswithmembernames interface com.karumi.dexter.** { *; }
10 changes: 7 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'

defaultConfig {
applicationId "com.karumi.dexter.sample"
minSdkVersion 14
Expand All @@ -12,15 +11,20 @@ android {
versionName "1.0"
}
buildTypes {
release {
debug {
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile project(':dexter')
}
12 changes: 12 additions & 0 deletions sample/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-renamesourcefileattribute SourceFile

# Butterknife
-dontwarn butterknife.internal.**
# Retain generated class which implement Unbinder.
-keep public class * implements butterknife.Unbinder { public <init>(**, android.view.View); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinding.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import android.support.v4.content.ContextCompat;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.karumi.dexter.Dexter;
Expand All @@ -46,10 +46,10 @@
*/
public class SampleActivity extends Activity {

@Bind(R.id.audio_permission_feedback) TextView audioPermissionFeedbackView;
@Bind(R.id.camera_permission_feedback) TextView cameraPermissionFeedbackView;
@Bind(R.id.contacts_permission_feedback) TextView contactsPermissionFeedbackView;
@Bind(android.R.id.content) ViewGroup rootView;
@BindView(R.id.audio_permission_feedback) TextView audioPermissionFeedbackView;
@BindView(R.id.camera_permission_feedback) TextView cameraPermissionFeedbackView;
@BindView(R.id.contacts_permission_feedback) TextView contactsPermissionFeedbackView;
@BindView(android.R.id.content) ViewGroup rootView;

private MultiplePermissionsListener allPermissionsListener;
private PermissionListener cameraPermissionListener;
Expand Down

0 comments on commit b0ca5d3

Please sign in to comment.