在proguard混淆之后的akka​​中的NoClassDefFoundError

时间:2016-10-16 03:08:36

标签: akka proguard noclassdeffounderror

我有一个使用 akka actor库的桌面(JavaFX)scala应用程序。在运行使用 proguard 进行模糊处理的应用程序jar之前,没有运行时错误。我处理了许多ClassNotFoundExceptions,根据需要向proguard.txt添加了keep选项。但是现在我已经在 NoClassDefFoundError 上被困了几个小时,其中包含以下(去混淆)堆栈跟踪

java.lang.NoClassDefFoundError: Could not initialize class akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool
        at akka.dispatch.ForkJoinExecutorConfigurator$ForkJoinExecutorServiceFactory.createExecutorService(ForkJoinExecutorConfigurator.java:432)
        at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.executor$lzycompute(Dispatcher.java:40)
        at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.executor(Dispatcher.java:40)
        at akka.dispatch.ExecutorServiceDelegate$class.execute(ExecutorServiceDelegate.java:209)
        at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.execute(Dispatcher.java:39)
        at akka.dispatch.Dispatcher.registerForExecution(Dispatcher.java:115)
        at akka.dispatch.MessageDispatcher.attach(MessageDispatcher.java:131)
        at akka.actor.dungeon.Dispatch$class.start(Dispatch.java:99)
        at akka.actor.ActorCell.start(ActorCell.java:374)
        at akka.actor.ActorCell.start(ActorCell.java:374)
        at akka.actor.LocalActorRef.start(LocalActorRef.java:341)
        at akka.actor.LocalActorRefProvider.guardian$lzycompute(LocalActorRefProvider.java:632)
        at akka.actor.LocalActorRefProvider.guardian(LocalActorRefProvider.java:626)
        at akka.actor.ActorSystemImpl.guardian(ActorSystemImpl.java:657)
        at akka.actor.ActorSystemImpl.terminate(ActorSystemImpl.java:690)
        at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystemImpl.java:675)
        at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystemImpl.java:663)
        at akka.actor.ActorSystemImpl._start(ActorSystemImpl.java:663)
        at akka.actor.ActorSystemImpl.start(ActorSystemImpl.java:679)
        at akka.actor.ActorSystem$.apply(ActorSystem.java:141)
        at akka.actor.ActorSystem$.apply(ActorSystem.java:108)
        at com.percebemusic.pianoapp.core.package$.<init>(package.java:14)
        at com.percebemusic.pianoapp.core.package$.<clinit>(package.java)
        at com.percebemusic.pianoapp.desktop.ui.Main.registerServices(Main.java:187)
        at com.percebemusic.pianoapp.desktop.ui.Main.start(Main.java:97)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(AccessController.java)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
        at java.lang.Thread.run(Thread.java:745)

“com.percebemusic.pianoapp.core.package $”代码看起来像这样(scala):

package object core {
  val AppActorSystem = ActorSystem("appSystem")
}

接下来的调用(Java):

    IocContainer.getInstance().register(ActorSystem.class, package$.MODULE$.AppActorSystem());

我的 proguard.txt 的akka​​部分,插入了几个人的解决方案,是:

#### Akka (from proguard sample for akka)
-keepclassmembernames class * implements akka.actor.Actor {
  akka.actor.ActorContext context;
  akka.actor.ActorRef self;
}
-keep class * implements akka.actor.ActorRefProvider {
  public <init>(...);
}
-keep class * implements akka.actor.ExtensionId {
  public <init>(...);
}
-keep class * implements akka.actor.ExtensionIdProvider {
  public <init>(...);
}
-keep class akka.actor.SerializedActorRef {
  *;
}
-keep class * implements akka.actor.SupervisorStrategyConfigurator {
  public <init>(...);
}
-keep class * extends akka.dispatch.ExecutorServiceConfigurator {
  public <init>(...);
}
-keep class * implements akka.dispatch.MailboxType {
  public <init>(...);
}
-keep class * extends akka.dispatch.MessageDispatcherConfigurator {
  public <init>(...);
}
-keep class akka.event.Logging*
-keep class akka.event.Logging$LogExt {
  public <init>(...);
}
-keep class akka.remote.DaemonMsgCreate {
  *;
}
-keep class * extends akka.remote.RemoteTransport {
  public <init>(...);
}
-keep class * implements akka.routing.RouterConfig {
  public <init>(...);
}
-keep class * implements akka.serialization.Serializer {
  public <init>(...);
}
-dontwarn akka.remote.netty.NettySSLSupport**
-dontnote akka.**

# (I added)
-keep class akka.event.slf4j.** { *; }
-keep class akka.actor.LightArrayRevolverScheduler { *; }
-keep class akka.**
-keep class akka.** { *; }
# Inner classes like akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool
#-keep class akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool { *; }
#-keepclassmembers class akka.** { *; }
#-keep class akka.**.*$*
#-keep class akka.**$*
-keep class com.percebemusic.pianoapp.core.package$ { *; }
-keep scala.concurrent.forkjoin.ForkJoinPool$ForkJoinWorkerThreadFactory { *; }

# below required to keep generic type parameters, on which akka reflects
-keepattributes Signature

# and from https://spin.atomicobject.com/2013/06/20/akka-scala-on-android/ (didn't help)
-keep class com.typesafe.**
-keep class akka.**
-keep class scala.collection.immutable.StringLike {
    *;
}
-keepclasseswithmembers class * {
    public <init>(java.lang.String, akka.actor.ActorSystem$Settings, akka.event.EventStream, akka.actor.Scheduler, akka.actor.DynamicAccess);
}
-keepclasseswithmembers class * {
    public <init>(akka.actor.ExtendedActorSystem);
}
-keep class scala.collection.SeqLike {
    public protected *;
}

# and from http://macroid.github.io/modules/Akka.html (didn't help)
-keep class akka.actor.LightArrayRevolverScheduler { *; }
-keep class akka.actor.LocalActorRefProvider { *; }
-keep class akka.actor.CreatorFunctionConsumer { *; }
-keep class akka.actor.TypedCreatorFunctionConsumer { *; }
-keep class akka.dispatch.BoundedDequeBasedMessageQueueSemantics { *; }
-keep class akka.dispatch.UnboundedMessageQueueSemantics { *; }
-keep class akka.dispatch.UnboundedDequeBasedMessageQueueSemantics { *; }
-keep class akka.dispatch.DequeBasedMessageQueueSemantics { *; }
-keep class akka.actor.LocalActorRefProvider$Guardian { *; }
-keep class akka.actor.LocalActorRefProvider$SystemGuardian { *; }
-keep class akka.dispatch.UnboundedMailbox { *; }
-keep class akka.actor.DefaultSupervisorStrategy { *; }
-keep class macroid.akka.AkkaAndroidLogger { *; }
-keep class akka.event.Logging$LogExt { *; }

# and from http://stackoverflow.com/questions/15823383/how-to-use-akka-project-under-android (didn't help)
-dontwarn scala.**
-keepclassmembers class * {
    ** MODULE$;
}
-keep class scala.collection.SeqLike {
    public protected *;
}
-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
-keep public class org.eatbacon.sfth.AnalogUpdateActivity
-keep public class org.eatbacon.sfth.UpdateDataTask
-keep public class org.eatbacon.sfth.ShowChartActivity

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

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

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

是什么造成的?或者跟踪它的任何好的提示?

0 个答案:

没有答案