我正在尝试为我的应用程序实现Proguard。使用以下代码,应用程序无法构建。

时间:2016-06-27 08:04:37

标签: android android-studio sdk proguard

gradle构建继续,直到不停止。有人可以帮助我吗?这是我的build.gradle文件:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}

if (project.hasProperty("WishupAssistant.signing")
    && new File(project.property("WishupAssistant.signing") + ".gradle").exists()) {
apply from: project.property("WishupAssistant.signing") + ".gradle";
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "in.wishup.assistant"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 18
    versionName "0.18"
}
buildTypes {
   debug {
       //apply plugin: 'maven'
       //runProguard true;
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        minifyEnabled true
        shrinkResources false
    }
}
}

repositories {
mavenCentral()
maven {
    url 'https://github.com/rockerhieu/mvn-repo/raw/master/'
}
maven { url 'https://maven.fabric.io/public' }
maven {
    url "https://jitpack.io"
}
maven { url 'http://clojars.org/repo' }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
    transitive = true;
}
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.citrus.sdk:payment-sdk:3.4.3:retrofitoldRelease@aar'
compile project(':libs:spinnerWheel')
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.github.goka.kenburnsview:library:1.0.3'
compile 'com.nineoldandroids:library:2.4.+'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.google.code.gson:gson:2.5'
compile 'com.pusher:pusher-java-client:0.3.3'
compile 'com.segment.analytics.android:analytics:4.+'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.squareup.okio:okio:1.3.0'
compile 'com.orhanobut:logger:1.8'
compile 'com.facebook.conceal:conceal:1.0.1@aar'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
compile 'com.android.support:support-v4:23.4.0'
}

这是proguard-rules.pro文件:     -useuniqueclassmembernames     -allowaccessmodification     -keepattributes SourceFile,LineNumberTable     -keepattributes Annotation     -keepattributes签名     -keepattributes InnerClasses       #original code:

 -keep class com.google.android.gms.** { *; }
 -dontwarn com.google.android.gms.**
 -dontwarn butterknife.**
 -dontwarn com.parse.**
 -dontwarn com.squareup.**
  -dontwarn retrofit.**
 -dontwarn org.slf4j.**
 -dontwarn org.jsoup.**

# Keep Retrofit
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.** *;
 }
-keepclassmembers class * {
@retrofit.** *;
 }

# Keep Picasso
  -keep class com.squareup.picasso.** { *; }
-keepclasseswithmembers class * {
@com.squareup.picasso.** *;
}
-keepclassmembers class * {
@com.squareup.picasso.** *;
}

# keep CardView

 -keep class android.support.v7.widget.RoundRectDrawable { *; }

#-keep class com.citrus.sdk:payment-sdk:3.4.3:retrofitoldRelease@aar
-keep class com.citrus.sdk { *; }

#keep parse
-keep class com.parse.** { *; }
-dontwarn com.parse.bolts.Task **

# com.android.support
-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

 # #ButterKnife 7

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }

-keepclasseswithmembernames class * {
 @butterknife.* <fields>;}

-keepclasseswithmembernames class * {
 @butterknife.* <methods>;}

# google play services
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class        

com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}


# keep jsoup

-keep public class org.jsoup.** {
 public *;
 }

# Gson
-keep interface com.google.gson.** { *; }
-keep class com.google.gson.** { *; }

# Pusher
-keep class com.pusher { *; }

-keep class com.segment.analytics.** { *; }

#OKHttp
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**

#OKIo
-keep class com.squareup.okio.** { *; }
-keep interface com.squareup.okio.** { *; }
-dontwarn com.squareup.okio.**

#orhanobut
-keep class com.orhanobut.** { *; }
-keep interface com.orhanobut.** { *; }
 -dontwarn com.orhanobut.**

 #facebook conceal
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
}

-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters      
class * {
  void set*(***);
  *** get*();
}

#fr.avianey.com.viewpagerindicator

-keep class fr.avianey.com.viewpagerindicator.** { *; }
-keep interface fr.avianey.com.viewpagerindicator.** { *; }
-dontwarn fr.avianey.com.viewpagerindicator.**

0 个答案:

没有答案