如何在Android下使用Akka项目

编程入门 行业动态 更新时间:2024-10-17 11:23:48
本文介绍了如何在Android下使用Akka项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我现在有点绝望我试图在Android(在Eclipse中)使用Akka项目(以scala编写),但无论如何,我无法使其工作。 为了简单起见,我创建了两个项目:一个Akka项目,使用sbt eclipse创建,然后导入到eclipse,并使用一个标准的android项目,使用项目创建向导。我可以参考Android代码中的Akka代码,但在运行时我总是得到一个 NoClassDefFoundError 。 如果有人可以指出,我真的很感激我在做什么错,或者我可以在我的Android应用程序中使用我的Akka项目。

解决方案

我觉得你的痛苦我花了小时,试图让sbt,proguard,scala,akka工作,并建议您从这里查看项目/ Build.scala:

github/fehguy/swagger -for-the-home / tree / master / android

具体来说, proguard 选项: / p>

Android中的proguardOption:= | -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 pub 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枚举* { | public static ** [] values(); | public static ** valueOf(java.lang.String); |} | | -keep class *实现android.os.Parcelable { | public static final android.os.Parcelable $ Creator *; |} .stripMargin

I'm a little bit desperate at the moment. I'm trying to use an Akka project (written in scala) under Android (in Eclipse), but whatever I try, I can't make it work. For simplicity I created two projects: One Akka project, created using sbt eclipse and then imported to eclipse, and one standard android project using the project creation wizard. I can reference the Akka-code from the android code, but at Runtime I always get a NoClassDefFoundError. I would really appreciate if someone could point out what I'm doing wrong or what I could in general do to use my Akka project in my Android app.

解决方案

I feel your pain. I spent hours trying to get sbt, proguard, scala, akka to work, and recommend you take a look at the project/Build.scala from here:

github/fehguy/swagger-for-the-home/tree/master/android

Specifically the proguard options:

proguardOption in Android := """ |-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 *; |} """.stripMargin

)

更多推荐

如何在Android下使用Akka项目

本文发布于:2023-11-25 15:17:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630265.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   如何在   Android   Akka

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!