1

I am trying to integrate proguard into my android project

the build.gradle file is

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

aaptOptions {
    cruncherEnabled = false
}
defaultConfig {
    applicationId "com.xx.week"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 22
    versionName "1.0"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}
   } dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.google.api-client:google-api-client:1.19.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.apis:google-api-services-youtube:v3-rev120-1.19.0'
compile 'com.facebook.fresco:fresco:0.10.0'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.linsea:universalvideoview:1.1.0@aar'
compile 'com.google.firebase:firebase-ads:9.0.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.google.android.gms:play-services-analytics:9.0.2'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'

compile files('libs/androidplayerlib.jar')
 }
apply plugin: 'com.google.gms.google-services'

and the proguard configuration file is proguard-project.txt

        # This is a configuration file for ProGuard.
       # http://proguard.sourceforge.net/index.html#manual/usage.html

       # Optimizations: If you don't want to optimize, use the
       # proguard-android.txt configuration file instead of this one, which
       # turns off the optimization flags.  Adding optimization introduces
       # certain risks, since for example not all optimizations performed by
       # ProGuard works on all versions of Dalvik.  The following flags turn
       # off various optimizations known to have issues, but the list may            not
       # be complete or up to date. (The "arithmetic" optimization can be
       # used if you are only targeting Android 2.0 or later.)  Make sure you
       # test thoroughly if you go this route.

       -optimizations            !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
       -optimizationpasses 5
       -allowaccessmodification
       -dontpreverify

       # The remainder of this file is identical to the non-optimized version
       # of the Proguard configuration file (except that the other file has
       # flags to turn off optimization).

       -dontusemixedcaseclassnames
       -dontskipnonpubliclibraryclasses
       -verbose

       -dontwarn javax.xml.**
       -keepattributes *Annotation*
       -keep public class com.google.vending.licensing.ILicensingService
       -keep public class com.android.vending.licensing.ILicensingService

       # For native methods, see                       http://proguard.sourceforge.net/manual/examples.html#native
       -keepclasseswithmembernames class * {
           native <methods>;
       }

       # keep setters in Views so that animations can still work.
       # see http://proguard.sourceforge.net/manual/examples.html#beans
       -keepclassmembers public class * extends android.view.View {
          void set*(***);
          *** get*();
       }

       # We want to keep methods in Activity that could be used in the XML attribute onClick
       -keepclassmembers class * extends android.app.Activity {
          public void *(android.view.View);
       }

       # For enumeration classes, see                       http://proguard.sourceforge.net/manual/examples.html#enumerations
       -keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
       }

                  -keep class * implements android.os.Parcelable {
         public static final android.os.Parcelable$Creator *;
       }

                  -keepclassmembers class **.R$* {
           public static <fields>;
       }

       -keepattributes SourceFile,LineNumberTable

       -dontusemixedcaseclassnames
       -dontskipnonpubliclibraryclasses
       -verbose

       -keep class android.support.v4.app.** { *; }
       -keep interface android.support.v4.app.** { *; }
       -keep class android.support.v7.app.** { *; }
       -keep interface android.support.v7.app.** { *; }


       -dontwarn java.nio.file.Files
       -dontwarn java.nio.file.Path
       -dontwarn java.nio.file.OpenOption
       -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement


       -keepattributes Signature
       -keep class com.crashlytics.** { *; }
       -dontwarn com.crashlytics.**

       -keep class org.apache.http.** { *; }
       -keep class org.apache.commons.codec.** { *; }
       -keep class org.apache.commons.logging.** { *; }
       -keep class android.net.compatibility.** { *; }
       -keep class android.net.http.** { *; }
       -keep class com.android.internal.http.multipart.** { *; }
       -dontwarn org.apache.http.**
       -dontwarn android.webkit.**

       -dontwarn org.apache.http.**
       -dontwarn android.net.http.AndroidHttpClient
       -dontwarn com.google.android.gms.**
       -dontwarn com.android.volley.toolbox.**

       -dontwarn soundcloud.android.crop.*
       -dontwarn org.apache.**
       -dontwarn android.webkit.**
       -dontwarn com.mixpanel.android.**
       -dontwarn com.google.android.**

       -dontwarn java.lang.invoke**
       -dontwarn org.apache.lang.**
       -dontwarn org.apache.commons.**
       -dontwarn com.squareup.okhttp.**

        -keep class com.android.volley.** { *; }
        -dontwarn com.android.volley.**
        -keep class com.google.api-client:google-api-client.** { *; }
        -dontwarn com.google.api-client:google-api-client.**
         -keep class com.google.code.gson.** { *; }
         -dontwarn com.google.code.gson.**

          -keep class com.google.apis:google-api-services-youtube.** { *; }
          -dontwarn com.google.apis:google-api-services-youtube.**

          -keep class com.facebook.fresco.** { *; }
          -dontwarn com.facebook.fresco.**

         -keep class com.google.firebase.** { *; }
         -dontwarn com.google.firebase.**

         -keep class com.linsea.** { *; }
         -dontwarn com.linsea.**

         -keep class com.baoyz.swipemenulistview.** { *; }
         -dontwarn com.baoyz.swipemenulistview.**

         -keep class com.google.android.gms.** { *; }
          -dontwarn com.google.android.gms.**

   -keep class com.android.support:multidex.** { *; }
   -dontwarn com.android.support:multidex.**

                  -keep class com.manoramaonline.week.Activity.GalleyYoutubeVideoDetailActivity

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

       # The support library contains references to newer platform versions.
       # Don't warn about those in case this app is linking against an older
       # platform version.  We know about them, and they are safe.
       -dontwarn android.support.**

Now am getting an error

 Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'.
> java.io.IOException: The output jar [C:\The            Week\app\build\intermediates\multi-dex\release\componentClasses.jar] must be   specified after an input jar, or it will be empty.

Is there any solution to sort this out

Geethu
  • 1,586
  • 6
  • 21
  • 34

0 Answers0