score:0

Accepted answer

You might have to fiddle with your "proguard.cfg" file.

Here's the one I use from a project using Scala 2.10 and Android with the IntelliJ IDE (change the first option to match your package name):

##
## Keep classes of named package
##
-keep public class **.keithpinson.**
## ## ## ## ## ## ## ## ## ## ## ## ##


##
## RELEASE ONLY
##
##-optimizationpasses 3
##-overloadaggressively
##-repackageclasses ''
##-allowaccessmodification
##-optimizations !code/simplification/arithmetic
##         ,!field/*,!class/merging/*,!code/allocation/variable
##-keepattributes *Annotation*

##
## DEBUG ONLY
##
-dontobfuscate
-dontoptimize
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
## -printmapping mapping.txt


##
## ALL VERSIONS
##
-dontpreverify
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontusemixedcaseclassnames


## Keep Limited Serializable Capability
##-keepclassmembers class * implements java.io.Serializable {
##    static long serialVersionUID;
##    private void writeObject(java.io.ObjectOutputStream);
##    private void readObject(java.io.ObjectInputStream);
##    java.lang.Object writeReplace();
##    java.lang.Object readResolve();
##}

## Keep All Serializable Capability
##-keep class * implements java.io.Serializable { *; }"





##
## ANDROID SETTINGS
##
-dontwarn com.google.common.collect.MinMaxPriorityQueue
-dontwarn com.google.common.primitives.UnsignedBytes$*

-dontnote android.app.backup.BackupAgentHelper
-dontnote com.android.vending.licensing.ILicensingService

-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>;
}

-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-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);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

# R classes may be built out of sequence so don't proguard them
-keep public class **.R { *; }
-keepclassmembers class **.R$* {
    public static <fields>;
}

# Removes all calls to Log. Delete the methods you want to keep.
-assumenosideeffects class android.util.Log {
    public static int v(...);
    #public static int d(...);
    public static int i(...);
    #public static int w(...);
    #public static int e(...);
    #public static int wtf(...);
}

## Fixes ==> Warning: ... can't find referenced class javax.xml.stream.events.XMLEvent
## -dontwarn javax.xml.**


## If using Guice
## -keep class com.google.common.base.Finalizable* {
##   <fields>;
##   <methods>;
## }
##
## -keep class com.google.common.base.internal.Finalizer {
##   <fields>;
##   <methods>;
## }


##
## SCALA SETTINGS
##
-dontwarn **$$anonfun$*
-dontwarn scala.android.**
-dontwarn scala.beans.ScalaBeanInfo
-dontwarn scala.collection.generic.GenTraversableFactory
-dontwarn scala.collection.immutable.RedBlack$Empty
-dontwarn scala.concurrent.forkjoin.**
-dontwarn scala.reflect.**
-dontwarn scala.sys.process.**
-dontwarn scala.tools.**,plugintemplate.**


#(org.xml.sax.EntityResolver)Class.forName(variable).newInstance()
-dontnote org.xml.sax.EntityResolver

#(org.apache.james.mime4j.storage.StorageProvider)Class.forName(variable).newInstance()
-dontnote org.apache.james.mime4j.storage.DefaultStorageProvider

-dontnote scala.android.app.Activity


## Keep All Scala Classes
##-keep class scala.** { *; }

-keep class scala.android.package**
-keep class * extends scala.android.app.Activity

## Fixes ==> Warning: ... can't find referenced class sun.misc.Unsafe
-libraryjars libs/jsr305-2.0.1.jar
-dontwarn sun.misc.Unsafe


-keep class * extends scala.runtime.MethodCache {
    public <methods>;
}

-keepclassmembers class * {
    ** MODULE$;
}

-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinPool {
    long eventCount;
    int workerCounts;
    int runControl;
    scala.concurrent.forkjoin.ForkJoinPool$WaitQueueNode syncStack;
    scala.concurrent.forkjoin.ForkJoinPool$WaitQueueNode spareStack;
}

-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinWorkerThread {
    int base;
    int sp;
    int runState;
}

-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinTask {
    int status;
}

-keepclassmembernames class scala.concurrent.forkjoin.LinkedTransferQueue {
    scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference head;
    scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference tail;
    scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference cleanMe;
}

score:0

Seems idea will use the system proguard configuration to optimize the jar when uncheck the Run ProGuard on Android facet, simple uncheck it seems don't work, so you need use some customized config for proguard, just try this, it work for me, please replace REPLACE WITH YOUR PACKAGE with you package

Of course, you may try Keith's config.

-dontobfuscate
-dontoptimize
-dontpreverify

-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers

-dontwarn

#scala.Enumeration accesses a field 'MODULE$' dynamically
-dontnote scala.Enumeration

#(org.xml.sax.EntityResolver)Class.forName(variable).newInstance()
-dontnote org.xml.sax.EntityResolver

#(org.apache.james.mime4j.storage.StorageProvider)Class.forName(variable).newInstance()
-dontnote org.apache.james.mime4j.storage.DefaultStorageProvider

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
            SourceFile,LineNumberTable,Annotation,EnclosingMethod

-keep public class REPLACE WITH YOUR PACKAGE

https://plus.google.com/106066742926663025812/posts/41XoDPeDEqc


Related Query