2

I am trying to deploy signed apk from android studio. I have configured the build.gradle with required credentials but I've got some warnings when I try to build the .apk. I tried adding some commands in proguard rules but still I get same warnings. How can I fix this issue?

Here are the pictures of the issue.

enter image description here enter image description here

And this is the gradles file.

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.neenbedankt.android-apt'
//apply plugin: 'com.google.gms.google-services'
android {
    signingConfigs {
        release {
            keyAlias 'something'
            keyPassword 'something'
            storeFile file('D:/something')
            storePassword 'something'
        }
    }
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.aam.skillschool"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.google.apis:google-api-services-youtube:v3-rev179-1.22.0'
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.jakewharton.timber:timber:4.3.1'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    apt 'com.google.dagger:dagger-compiler:2.7'
    compile 'com.google.dagger:dagger:2.7'
    provided 'javax.annotation:jsr250-api:1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'br.com.mauker.materialsearchview:materialsearchview:1.2.0'
    compile 'com.google.http-client:google-http-client-android:+'
    compile 'com.google.api-client:google-api-client-android:+'
    compile 'com.google.api-client:google-api-client-gson:+'
}

Thanks in advance!

Zeeshan Shabbir
  • 6,704
  • 4
  • 38
  • 74

1 Answers1

1

you have the non-use classes of your imported libraries already deleted by proguard, revert back to the version where u had no pro-guard applied,that version should work.Then carefully include all your exceptions and rules of all your libraries in your pro-guard rules and then try to use the proguard

Ak9637
  • 990
  • 6
  • 12
  • I have emptied the pro-guard and sync the project. I get no error except some warning of ```Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.``` and ```Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.``` but when i run the project i get the same errors as above – Zeeshan Shabbir Nov 29 '16 at 07:59
  • yes ,because gradle thinks the libraries you included actually exist in ur build. but when you build,it look for specific classes and as proguard has stripped those away they can no longer be found.So i think you should try the suggestion i made .I encountered the same issue as you and solved it this way – Ak9637 Nov 29 '16 at 08:15
  • ```Then carefully include all your exceptions and rules of all your libraries in your pro-guard rules and then try to use the proguard``` how can i do that? please guide here – Zeeshan Shabbir Nov 29 '16 at 08:25
  • visit the pages of all the libraries you are using ,generally every library developers includes instructions to added to proguard for their library – Ak9637 Nov 29 '16 at 08:26
  • to me its strange that i can manually remove signingConfigs from build.gradle and set ```minifyEnable false``` and then i generate signed apk then android studio generate the signed one without any error. just a warning related to httpclient – Zeeshan Shabbir Nov 29 '16 at 08:49
  • if you are able to generate the release apk,where and when do u get the errror then ? – Ak9637 Nov 29 '16 at 09:15
  • I get error when i want to generate release apk using run button from android studio – Zeeshan Shabbir Nov 29 '16 at 09:32
  • Yes i am generating signed apk like this build->generate signed apk. – Zeeshan Shabbir Nov 29 '16 at 09:38
  • basically i want to debug the signed apk since i am using in app billing. So i want to add some functionalities that depends on the response from in app billing. – Zeeshan Shabbir Nov 29 '16 at 09:39
  • and like u mentioned ,minifyEnable false, will disable the function/checks that proguard runs.So its evident it will throw error if used.I m not particullarly sure abt this,but i guess proguard is the one that actually runs the classes checks – Ak9637 Nov 29 '16 at 09:39
  • if debug is the target u hold, then u can simply run all your builds with minify set to false.Nd turn to true only when u release to store,would that work for u ? – Ak9637 Nov 29 '16 at 09:41
  • nd have u tried reverting back to the last known working build ? – Ak9637 Nov 29 '16 at 09:42
  • I'd check on this will let you know about it then. Thanks for your attentions to this question – Zeeshan Shabbir Nov 29 '16 at 09:42
  • Yes i did. which was the ``` build->generate signed apk``` – Zeeshan Shabbir Nov 29 '16 at 09:43
  • if u find a more robust solution , please leave a link for that .ty – Ak9637 Nov 29 '16 at 09:45