3

In my Android application, We have integrated Paypal Payment method. It's working Fine. But we are not able to generate Release Apk. Please help me to find out the solution for this.

Here is my Log

Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComMcxiaokeVolleyLibraryAar100Library UP-TO-DATE
:app:prepareComPaypalSdkPaypalAndroidSdk2131Library UP-TO-DATE
:app:prepareIoCardAndroidSdk530Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJavaWithJavac UP-TO-DATE
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources UP-TO-DATE
:app:proguardRelease
Note: there were 29 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.common.GooglePlayServicesUtil
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning:com.paypal.android.sdk.br: can't find referenced class com.google.android.gms.common.GooglePlayServicesUtil
Warning:com.paypal.android.sdk.bs: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning:com.paypal.android.sdk.bs: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning:com.paypal.android.sdk.bs: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient
Warning:com.paypal.android.sdk.bs: can't find referenced class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Files
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:there were 24 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Exception while processing task 
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:473)
    at proguard.ProGuard.initialize(ProGuard.java:233)
    at proguard.ProGuard.execute(ProGuard.java:98)
    at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
    at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
    at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
    at com.android.builder.tasks.Job.runTask(Job.java:48)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
    at java.lang.Thread.run(Thread.java:745)
:app:dexRelease UP-TO-DATE
:app:validateConfigSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of E:\AMI_REPO\auido\trunk\Customers\AMITekh\C-Tunes\Clients\Android\cTunes\app\build\intermediates\classes-proguard\release\classes.jar
Information:BUILD FAILED
Information:Total time: 5.526 secs
Information:1 error
Information:23 warnings
Information:See complete output in console

Build file

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.android.support:palette-v7:+'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.paypal.sdk:paypal-android-sdk:2.13.1'
}

Proguard.txt file

-dontwarn android.support.**
-dontwarn com.parse.*
-dontwarn com.paypal.android.*
-dontwarn com.google.android.gms.*
Moses
  • 333
  • 1
  • 6
  • 19

3 Answers3

0

you shoud use keep like below:

-keep class android.support.** { *; }
-keep interface android.support.** { *; }

-keep class com.parse.** { *; }
-keep interface com.parse.** { *; }

-keep class com.paypal.android.** { *; }
-keep interface com.paypal.android.** { *; }

-keep class com.google.android.gms.** { *; }
-keep interface com.google.android.gms.** { *; }
masoud vali
  • 1,528
  • 2
  • 18
  • 29
  • yes. just try keep for each library you use. some of them doesn't need keep – masoud vali Feb 22 '16 at 07:17
  • Warnings have Gone.. But it's giving following error – Moses Feb 22 '16 at 07:26
  • Error:Execution failed for task ':app:packageRelease'. > Unable to compute hash of E:\AMI_REPO\auido\trunk\Customers\AMITekh\C-Tunes\Clients\Android\cTunes\app\build\intermediates\classes-proguard\release\classes.jar – Moses Feb 22 '16 at 07:26
  • try this: http://stackoverflow.com/questions/31643339/errorexecution-failed-for-task-apppackagerelease-unable-to-compute-hash – masoud vali Feb 22 '16 at 13:34
0

I had the same problem.

Adding -dontwarn okio.** to the proguard-project.txt solved the problem for me.

Not sure, if this might cause problems for some features, but my one-time-payment worked fine.

Great Job Paypal. First v2.10.0 stops working with no warning and v2.13.1 needs additional proguard stuff...

jpm
  • 3,300
  • 1
  • 19
  • 29
0

You need to add this in your proguard file: -dontwarn com.paypal.android.** instead of -dontwarn com.paypal.android.*

Muhammad Muzammil
  • 1,313
  • 1
  • 12
  • 28