ant release proguard fails, but under eclipse works

383 views Asked by At

I have a pretty big project with an elaborate proguard.cfg .

  • This project builds OK under eclipse, proguard runs without errors, and the app works perfectly, it's been my normal workflow for months.

I am trying to build it from command line using ant.

I have updated build.xml, etc.. on the projects and its library project using

 android update project -p .
 android update project -s --target android-17 -p .
  • The debug version, ant debug, gets built successfully
  • However, ant release fails proguard, complaining about missing classes.

From what I could decipher (a lot of non-faltal warnings pop up) the problems are related to a missing inner class in one of my (thousand) classes, and to missing R (resources) of a dependent library project. This is strange, both things do exist, the library projects gets built OK from eclipse & ant, and that inner class i don't know, the parent class is pretty trivial.

Why does it build under eclipse and not using command line? Shouldn't the updated build scripts produce the same result?

Proguard: Errors Related to LIbrary Project Resources

 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
 [proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R

Proguard: Related to inner class not found

 [proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$2: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
 [proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$3: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
 [proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
 [proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
 [proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
1

There are 1 answers

0
rupps On

That's strange, I found the problem by trial and error.

The inner class not found was an innocent private anonymous runnable like:

private Runnable mBlinkRunner=new Runnable() {

    public void run() {
        .
        . couple simple lines 
        .

    }
};

I changed it to ...

protected Runnable mBlinkRunner=new Runnable() {

    public void run() {
        .
        . couple simple lines 
        .

    }
};

and it worked... I wonder why this happens, there should be like hundreds of runnables like these through the project.