jberkel / android-plugin

An sbt plugin for Android development in Scala
https://groups.google.com/forum/#!forum/scala-on-android
Other
476 stars 113 forks source link

Proguard strips classes mentioned in XML layout. #9

Closed Synesso closed 14 years ago

Synesso commented 14 years ago

This may be a tricky one, but I suspect that it is not possible to use custom classes in XML layouts as proguard will not recognise the reference. Perhaps the plugin should parse classnames from XML layouts and pass these to proguard as keepers.

e.g.

The XML layout includes reference to net.badgerhunt.hwa.ScribbleView

The full jar...

jar tvf target/scala_2.7.7/hwandroidproject_2.7.7-0.1.jar 
    25 Wed May 12 14:44:38 EST 2010 META-INF/MANIFEST.MF
   320 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R$string.class
   464 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R.class
   324 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R$drawable.class
   991 Wed May 12 14:44:34 EST 2010 net/badgerhunt/hwa/MainActivity.class
   264 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R$attr.class
   316 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R$layout.class
  1835 Wed May 12 14:27:42 EST 2010 net/badgerhunt/hwa/ScribbleView.class
   477 Wed May 12 14:44:36 EST 2010 net/badgerhunt/hwa/R$id.class

The minimum jar ...

jar tvf target/scala_2.7.7/classes.min.jar 
   793 Wed May 12 14:44:56 EST 2010 net/badgerhunt/hwa/MainActivity.class
   316 Wed May 12 14:44:56 EST 2010 net/badgerhunt/hwa/R$layout.class
   272 Wed May 12 14:44:56 EST 2010 net/badgerhunt/hwa/R.class
Synesso commented 14 years ago

Perhaps add to AndroidProject:136 "-keep public class * extends android.view.View" ::

jberkel commented 14 years ago

Don't remove generated layouts (proguard)

Closed by c7b07d5220fddb2fdfffc48172d6560e35491bb5.