Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while generating signed apk

Tags:

android

apk

I got old project and keystore file , but when I am trying to create signed APK it give following error.

   [2013-05-19 12:36:02 - xxxxxxx] Proguard returned with error code 1. See console
   [2013-05-19 12:36:02 - xxxxxxx] Unable to access jarfile /Users/muhammadali/Documents/development
   [2013-05-19 12:36:12 - xxxxxx] Proguard returned with error code 1. See console
    [2013-05-19 12:36:12 - xxxxxx] Unable to access jarfile /Users/muhammadali/Documents/development

Please help why i cant generate the APK file.

like image 600
Ali Avatar asked Jun 29 '26 11:06

Ali


1 Answers

Alright, a few things:

  1. Make sure your Proguard is version 4.8 and above. There is a known bug that caused that in 4.7.

  2. Assuming you are running the latest version of Proguard and it is still occuring, go to [android-sdk-folder]/sdk/tools/proguard/bin/proguard.sh and make the following changes:

    Change:

    java -jar $PROGUARD_HOME/lib/proguard.jar "$@"
    

    To:

    java -jar "$PROGUARD_HOME/lib/proguard.jar" "$@"
    
  3. Add this line to your project.properties file in your application folder.

    proguard.config=proguard.cfg
    
  4. Create a proguard.cfg file in your application folder.

  5. Populate your proguard.cfg file with something like below (modify as needed).

    -optimizationpasses 5
    -dontusemixedcaseclassnames
    -dontskipnonpubliclibraryclasses
    -dontpreverify
    -verbose
    -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
    
    -keep public class * extends android.app.Activity
    -keep public class * extends android.app.Application
    -keep public class * extends android.app.Service
    -keep public class * extends android.content.BroadcastReceiver
    -keep public class * extends android.content.ContentProvider
    -keep public class * extends android.app.backup.BackupAgentHelper
    -keep public class * extends android.preference.Preference
    -keep public class com.android.vending.licensing.ILicensingService
    
    -keepclasseswithmembernames class * {
        native <methods>;
    }
    
    -keepclasseswithmembers class * {
        public <init>(android.content.Context, android.util.AttributeSet);
    }
    
    -keepclasseswithmembers class * {
        public <init>(android.content.Context, android.util.AttributeSet, int);
    }
    
    -keepclassmembers class * extends android.app.Activity {
       public void *(android.view.View);
       public void onSearchButtonClicked(java.lang.String);
    }
    
    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    
    -keep class * implements android.os.Parcelable {
       public static final android.os.Parcelable$Creator *;
    }
    
  6. Turn Project -> Build Automatically off Go to menu Project -> Clean... and clean your project first.

Good luck! I'll be happy to help out as you try all the steps above and go through it.

like image 97
kushyar Avatar answered Jul 02 '26 01:07

kushyar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!