1

Clicks not working in release apk after proguard

I can deploy app to emulator or even real android smartphone and everything works fine but when I create a release apk, transfer it to phone, I cannot play because the clicks don't work. Actually, I can click the buttons but they don't follow through. Like 'Play' button when I click it shows that I am clicking it but it does not start the game to play. I have played around with proguard a lot and even tried to change to minifyEnabled to false and shrinkResource to false but now it give an error about a lock PID error. Tried everything I know so far. I know I must not be including something in the proguard file I just cannot get what it is.

my proguard file:

-dontusemixedcaseclassnames

-dontskipnonpubliclibraryclasses

-verbose

Optimization is turned off by default. Dex does not like code run through the ProGuard optimize and preverify steps (and performs some of these optimizations on its own).

-dontoptimize

-dontpreverify

Note that if you want to enable optimization, you cannot just include optimization flags in your own project configuration file; instead you will need to point to the "proguard-android-optimize.txt" file instead of this one from your project.properties file.

-keepattributes *Annotation*

-keep public class com.google.vending.licensing.ILicensingService

-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;`
}


-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);
}

enumerations

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}


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

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

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.**

Understand the @Keep support annotation.

-keep class android.support.annotation.Keep


-keep @android.support.annotation.Keep class * {*;}


-keepclasseswithmembers class * {
    @android.support.annotation.Keep <methods>;
}


-keepclasseswithmembers class * {
    @android.support.annotation.Keep <fields>;
}


-keepclasseswithmembers class * {
    @android.support.annotation.Keep <init>(...);
}

END

My build.gradle file has proguard like this:

buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt')
    }

I am not using any custom file. I did before but just deleted and I amusing that txt file now.

I am using multiDex cause file size got too big. I am using firebase core external library. Here are the libraries:

dependencies {
    compile 'com.google.android.gms:play-services-  appindexing:9.0.2'
    compile 'com.google.android.gms:play-services-analytics:9.0.2'
    compile 'com.google.android.gms:play-services-location:9.0.2'
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.google.android.gms:play-services-auth:9.0.2'
    compile 'com.google.android.gms:play-services-gcm:9.0.2'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:24.0.0
}

Due to this issue, I cannot publish my first app.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

-1

Ok got it to work by disabling the proguard feature though I would love to know how to use proguard too. Right now app is 17mb but maybe it can be smaller with proguard?