This page is no longer maintained — Please continue to the home page at www.scala-lang.org

[Scala on Android] NoSuchMethodException excepiton

1 reply
linjie nie
Joined: 2009-06-17,
User offline. Last seen 42 years 45 weeks ago.


Hi list -
I have a jar with following two objects, having no difference functional.
They work fine and have the same behaver on "normal" platform.
But when I dx them to android platform (using the cool sbt plugin - https://github.com/jberkel/android-plugin), the first one failed, throwing NoSuchMethodException.
proguard has not deleted the methods, since I put them both in "-keep" arg.
Any advice?
Thanks a lot.


object Helper {
  implicit def helpersWrap[A](obj: A) = new {
    def applyTo[B](f: A => B) = {
      f(obj)
    }
  }
}

object Helper2 {
  class Wrapped[A](val obj:A){
    def applyTo[B](f: A => B) = {
      f(obj)
    }
  }
  implicit def helpersWrap[A](obj: A) = new Wrapped(obj)
}

paulbutcher
Joined: 2010-03-08,
User offline. Last seen 10 weeks 5 days ago.
Re: [Scala on Android] NoSuchMethodException excepiton

On 15 Oct 2011, at 17:07, linjie nie wrote:
> proguard has not deleted the methods, since I put them both in "-keep" arg.
> Any advice?

I know from bitter experience that Proguard does not always behave as you think it might. I would suggest verifying that it really hasn't discarded anything you want it to keep by using dexdump before looking elsewhere.

--
paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: paul [at] paulbutcher [dot] com
AIM: paulrabutcher
Skype: paulrabutcher

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland