1

EDIT: I have a solution for my problem, see below in the answers

I have searched and read all related questions on this issue, but none has worked for me. I have an app which uses ViewPager Indicator as Library and it has a class application.

The app runs fine on the emulator, but when I try to export as signed apk.

Depending on the answers given for this exception and those which I have tried, it sometimes failed with error "Conversion to Dalvik format failed with error 1" or It exports correctly and crashes on the device.

Something peculiar though, when I run on the emulator, the apk generated is 600kb+ and when i export as signed apk it is around 300kb. It is somehow not referencing the library.

What I tried:

  1. Default settings with only ViewPager referenced as library in the android properties
  2. Adding JARs(ViewPager indicator and support ) in the libs folder

Any help will be much appreciated. Thanks

Vannen
  • 712
  • 2
  • 7
  • 17
  • 1
    Try [this](http://stackoverflow.com/a/11824038/940096) once with your app – Praveenkumar Sep 12 '12 at 07:03
  • Have you exported your jar files in Project> Properties > Java Build Path > Order and Export. Just go in there and check mark all your jar files. – Yogesh Somani Sep 12 '12 at 07:35
  • fix your project properties from...Project > Android Tools > Fix Project Properties...and delete that project from eclipse then import it to eclipse...after that clean & build your project... – Priyank Patel Sep 12 '12 at 08:12
  • Yeh I did those. I noticed in the logs, it says "Cannot read jar file contents..." But the files are there in libs folder and referenced in build path – Vannen Sep 12 '12 at 08:13

1 Answers1

0

I found out that the issue was with proguard. If you have a class on the application level you should tell proguard to keep it public.

This is how I did it. I am currently using ADT20, I dont know if it is the same for older versions.

In file: proguard-project.txt append this line (MyAPP being the class)

-keep public class <MyAPP> 

In file: project.properties uncomment this line

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

More info here:http://developer.android.com/tools/help/proguard.html#configuring

Vannen
  • 712
  • 2
  • 7
  • 17