Has anyone tried akka-persistence on Android?

164 views
Skip to first unread message

Tim Pigden

unread,
Apr 25, 2014, 3:38:41 AM4/25/14
to akka...@googlegroups.com
My co-worker is struggling (it's probably proguard) and it would be useful to know if somebody had succeeded. 

Martin Krasser

unread,
Apr 25, 2014, 4:06:58 AM4/25/14
to akka...@googlegroups.com
Hi Tim,

what error message do you see?



On 25.04.14 09:38, Tim Pigden wrote:
My co-worker is struggling (it's probably proguard) and it would be useful to know if somebody had succeeded. 
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
Martin Krasser

blog:    http://krasserm.blogspot.com
code:    http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

Tim Pigden

unread,
Apr 25, 2014, 4:41:10 AM4/25/14
to akka-user@googlegroups com
Hi Martin
Unfortunately I don't have his code (he's inn a different Timezone and I only got email last night) but his stack trace 


so it looks like there's some reason it can't find the akka.persistence.DeliveredByChannelBatching
constructor.

I'll get him to add further info here as soon as he comes on line.




You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/qaBSx6sJH2Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in England and Wales.
Company Registration No. 2327613 Registered Offices: Suite 6,The Maltings, Hoe Lane, Ware, SG12 9LR England 
This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Optrak Distribution Software Ltd. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.

Martin Krasser

unread,
Apr 25, 2014, 7:48:24 AM4/25/14
to akka...@googlegroups.com

On 25.04.14 10:41, Tim Pigden wrote:
Hi Martin
Unfortunately I don't have his code (he's inn a different Timezone and I only got email last night) but his stack trace 


so it looks like there's some reason it can't find the akka.persistence.DeliveredByChannelBatching
constructor.

Hmm, this constructor actually exists.



I'll get him to add further info here as soon as he comes on line.

Yes please. I'd also like to know:

Have you tried running it on other platforms?
What Akka version do you use?

Tim Pigden

unread,
Apr 25, 2014, 7:58:12 AM4/25/14
to akka-user@googlegroups com
Hi Martin,
When I get hold of him I intend to ensure we can run a simple test program in both "standard" environment before re-testing on Android. I can see the DeliveredByChannelBatching is part of the standard start-up process and there's no obvious reason the constructor should be "missing". From what little I know of Android development, the culprit in these cases is usually Proguard being over-enthusiastic about pruning stuff it thinks is not required.

If we can get a simple test program working I'll make sure we make it available. Personally I think the eventsource model is an excellent way of overcoming the problems associated with mobile applications being randomly stopped and restarted, either due to the Android OS kicking them out or users powering on and off.


Martin Krasser

unread,
Apr 25, 2014, 8:04:31 AM4/25/14
to akka...@googlegroups.com

On 25.04.14 13:58, Tim Pigden wrote:
Hi Martin,
When I get hold of him I intend to ensure we can run a simple test program in both "standard" environment before re-testing on Android. I can see the DeliveredByChannelBatching is part of the standard start-up process and there's no obvious reason the constructor should be "missing". From what little I know of Android development, the culprit in these cases is usually Proguard being over-enthusiastic about pruning stuff it thinks is not required.

If we can get a simple test program working I'll make sure we make it available. Personally I think the eventsource model is an excellent way of overcoming the problems associated with mobile applications being randomly stopped and restarted, either due to the Android OS kicking them out or users powering on and off.

Absolutely, I also plan to run akka-persistence on Android in the near future, so I'm very interested about your findings.

Oscar Vargas Torres

unread,
Apr 25, 2014, 3:16:50 PM4/25/14
to akka...@googlegroups.com, kras...@googlemail.com
Hello Martin Krasser!

First: Thanks for your contributions to akka-persistence.

Can you please take a look at:
https://github.com/Optrak/akkaPersistenceNoAndroid
&
https://github.com/Optrak/akkaPersistenceWithAndroid

I am available to answer questions and help as much as I can. We want to be able to use akka-persistence on Android!

Oscar Vargas Torres

unread,
Apr 25, 2014, 6:18:45 PM4/25/14
to akka...@googlegroups.com, kras...@googlemail.com
As usually happens, Perry Nguyen has helped me and taught me something. He told me on irc channel #sbt-android that

https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg2.txt#L203 shows the guilty guy:

pfn: can see what exactly is null there
pfn:     public static final int CPU_DATA_MODEL = Integer.getInteger("sun.arch.data.model");
pfn: https://github.com/dain/leveldb/blob/master/leveldb/src/main/java/org/iq80/leveldb/impl/Iq80DBFactory.java#L32
pfn: there you go
pfn: leveldb won't even work on android
pfn: there is no system property sun.arch.data.model
pfn: so it returns null, unboxing to int => nullpointer

So what are the alternatives?

Oscar Vargas Torres

unread,
Apr 25, 2014, 8:26:08 PM4/25/14
to akka...@googlegroups.com, kras...@googlemail.com
I think I'm getting closer, but still see the error at https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg5.txt

Martin Krasser

unread,
Apr 26, 2014, 2:44:31 AM4/26/14
to akka...@googlegroups.com
Hi Oscar,

this error is related to the mapdb journal plugin (which is not an official part of akka-persistence). Please try using the LevelDB Java port (which is part of akka-persistence) i.e. make sure you have the following setting in application.conf:
akka.persistence.journal.leveldb.native = false
(and remove the mapdb plugin configuration). The LevelDB Java port doesn't use any native libs.

Does that help?

BTW why do you copy&paste settings from reference.conf into your application.conf file?

Cheers,
Martin

Oscar Vargas Torres

unread,
Apr 28, 2014, 10:30:54 AM4/28/14
to akka...@googlegroups.com, kras...@googlemail.com
Hello Martin.

Thanks a lot for helping us.

Following your suggestion gives this error:
https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt

Line 13:
04-28 08:54:25.036 12011-12032/com.optrak.sample I/System.out﹕ Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'journal.plugin'

This error shows that the configuration by default provided by "reference.conf" isn't merged or automatically included **on Android**, as it usually happens on a "normal" development environment. Maybe this answers your question
> why do you copy&paste settings from reference.conf into your application.conf file?

And also this error (take a look at line 49 https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt#L49)
04-28 08:54:25.046  12011-12032/com.optrak.sample I/System.out﹕ Caused by: akka.actor.InvalidActorNameException: actor name [snapshot-store] is not unique!

This (kind of) error
 
actor name [xxx] is not unique!
has been troubling us and have no idea what is the source of problem (on Android)

------
By the way, did you read this (from a previous message)? What do you think?


> https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg2.txt#L203 > shows the guilty guy:
>
> pfn: can see what exactly is null there
> pfn:    public static final int CPU_DATA_MODEL = Integer.getInteger("sun.arch.data.model");
> pfn: https://github.com/dain/leveldb/blob/master/leveldb/src/main/java/org/iq80/leveldb/impl/Iq80DBFactory.java#L32
> pfn: there you go
> pfn: leveldb won't even work on android
> pfn: there is no system property sun.arch.data.model
> pfn: so it returns null, unboxing to int => nullpointer

This error was obtained before removing every reference to leveldb in my application.conf. After that, it seemed I had some progress, because the next error message (errorMsg5.txt) seemed to be related to permissions to
write on the Android device.

Martin Krasser

unread,
Apr 28, 2014, 11:03:00 AM4/28/14
to akka...@googlegroups.com


On 28.04.14 16:30, Oscar Vargas Torres wrote:
Hello Martin.

Thanks a lot for helping us.

Following your suggestion gives this error:
https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt

Line 13:
04-28 08:54:25.036  12011-12032/com.optrak.sample I/System.out﹕ Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'journal.plugin'

The problem is that you've commented out the "plugin" key (inside journal { ... }) in your application conf file. For using the LevelDB Java port, make sure that you also have the following settings included (assuming that reference.conf is not loaded on Android for whatever reason).

akka {

  persistence {

    journal {
      ...
     
      plugin = "akka.persistence.journal.leveldb"

      leveldb {
        class = "akka.persistence.journal.leveldb.LeveldbJournal"
        plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
        replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
        dir = "journal"
        fsync = on
        checksum = off
        native = off
      }
      ...
   }
}

More details how to configure journals at http://doc.akka.io/docs/akka/2.3.2/scala/persistence.html#storage-plugins



        This error shows that the configuration by default provided by
        "reference.conf" isn't merged or automatically included **on
        Android**, as it usually happens on a "normal" development
        environment. Maybe this answers your question 
> why do you copy&paste settings from reference.conf into your application.conf file?

And also this error (take a look at line 49 https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt#L49)
04-28 08:54:25.046  12011-12032/com.optrak.sample I/System.out﹕ Caused by: akka.actor.InvalidActorNameException: actor name [snapshot-store] is not unique!

This (kind of) error
    actor name [xxx] is not unique!
has been troubling us and have no idea what is the source of problem (on Android)

------
By the way, did you read this (from a previous message)? What do you think?

>  https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg2.txt#L203
>            shows the guilty guy:
>
> pfn: can see what exactly is null there
> pfn:    public static final int CPU_DATA_MODEL = Integer.getInteger("sun.arch.data.model");
> pfn: https://github.com/dain/leveldb/blob/master/leveldb/src/main/java/org/iq80/leveldb/impl/Iq80DBFactory.java#L32
> pfn: there you go
> pfn: leveldb won't even work on android
> pfn: there is no system property sun.arch.data.model
> pfn: so it returns null, unboxing to int => nullpointer

This error was obtained before removing every reference to leveldb in my application.conf. After that, it seemed I had some progress, because the next error message (errorMsg5.txt) seemed to be related to permissions to
write on the Android device.

Martin Krasser

unread,
Apr 28, 2014, 11:17:53 AM4/28/14
to akka...@googlegroups.com

On 28.04.14 16:30, Oscar Vargas Torres wrote:
Hello Martin.

Thanks a lot for helping us.

Following your suggestion gives this error:
https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt

Line 13:
04-28 08:54:25.036  12011-12032/com.optrak.sample I/System.out﹕ Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'journal.plugin'

This error shows that the configuration by default provided by "reference.conf" isn't merged or automatically included **on Android**, as it usually happens on a "normal" development environment. Maybe this answers your question
> why do you copy&paste settings from reference.conf into your application.conf file?

And also this error (take a look at line 49 https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg6.txt#L49)
04-28 08:54:25.046  12011-12032/com.optrak.sample I/System.out﹕ Caused by: akka.actor.InvalidActorNameException: actor name [snapshot-store] is not unique!

This (kind of) error
    actor name [xxx] is not unique!
has been troubling us and have no idea what is the source of problem (on Android)

------
By the way, did you read this (from a previous message)? What do you think?

>  https://github.com/Optrak/akkaPersistenceWithAndroid/blob/master/errorMsg2.txt#L203
>            shows the guilty guy:
>
> pfn: can see what exactly is null there
> pfn:    public static final int CPU_DATA_MODEL = Integer.getInteger("sun.arch.data.model");
> pfn: https://github.com/dain/leveldb/blob/master/leveldb/src/main/java/org/iq80/leveldb/impl/Iq80DBFactory.java#L32

just looked at it now:


    public static final int CPU_DATA_MODEL = Integer.getInteger("sun.arch.data.model");
    public static final boolean USE_MMAP = Boolean.parseBoolean(System.getProperty("leveldb.mmap", ""+(CPU_DATA_MODEL>32)));

Try setting up the system properties ("sun.arch.data.model" and "leveldb.mmap ...") yourself in a way so that USE_MMAP is finally set to false.



> pfn: there you go
> pfn: leveldb won't even work on android
> pfn: there is no system property sun.arch.data.model
> pfn: so it returns null, unboxing to int => nullpointer

This error was obtained before removing every reference to leveldb in my application.conf. After that, it seemed I had some progress, because the next error message (errorMsg5.txt) seemed to be related to permissions to
write on the Android device.

Martin Krasser

unread,
Apr 28, 2014, 11:25:27 AM4/28/14
to akka...@googlegroups.com
Forgot to mention that CPU_DATA_MODEL isn't used anywhere else in the leveldb code.

Oscar Vargas Torres

unread,
Apr 29, 2014, 1:18:15 PM4/29/14
to akka...@googlegroups.com, kras...@googlemail.com

Martin Krasser

unread,
Apr 30, 2014, 1:12:25 AM4/30/14
to akka...@googlegroups.com
This is great, thanks a lot for sharing your experience!

Cheers,
Martin
Reply all
Reply to author
Forward
0 new messages