Menu

Can't use in my Android Project

Anonymous
2015-02-09
2015-09-06
  • Anonymous

    Anonymous - 2015-02-09

    I am trying to use this great library in my android project, but I always get this exception while streaming any list:

    java.lang.ExceptionInInitializerError
    Caused by: java.lang.ExceptionInInitializerError
    Caused by: java.lang.ExceptionInInitializerError
    Caused by: java.lang.Error: java.lang.NoSuchFieldException: theUnsafe
    Caused by: java.lang.NoSuchFieldException: theUnsafe

    Here is a full stacktrace: http://pastebin.com/raw.php?i=SetVUCHU
    Code that caused fatal exception: http://pastebin.com/FdHgJmts

    I have also added gradle-Retrolabda to my project. Here is a full build.gradle file: http://pastebin.com/9akA4V0d

    It works well with pure Java projects. Maybe I have to do some special things to integrate it with Android project? Now it is only in dependency list as: "compile 'net.sourceforge.streamsupport:streamsupport:1.1.3'"
    Though, I can't use your library and have no point what caused an error. Thank you for any help.

    UPD: I'm going to create a sample empty project to find out whether the error is in my project or in the library. I'll post a link to github repo in order to allow you to launch and test it too.

    UPD2: An exception is confirmed on newly created empty project. Check it out: https://github.com/NoSuchFieldException/streamsupport-test

     

    Last edit: Anonymous 2015-02-09
  • Anonymous

    Anonymous - 2015-02-09

    Do this:

    System.setProperty("java8.util.Spliterators.assume.oracle.collections.impl", "false");

    before java8.util.Spliterators is loaded (better: before anything from streamsupport is used at all).

     
    • Anonymous

      Anonymous - 2015-02-09

      Thanks. Everything is working now. Hope that 1.1.4 will fix this regrettable issue.

       
      • Stefan Zobel

        Stefan Zobel - 2015-02-09

        Actually, streamsupport hasn't been intended to support Android from the inception.

        This is because the implementation is highly dependent on the presence of some non-official API that may be missing on a non-Sun/Oracle Java runtime.

        It didn't occur to me until lately that the library may be of special interest to Android users. The upcoming 1.1.4 release is purpose-built for usage on Android.

         
  • Stefan Zobel

    Stefan Zobel - 2015-09-06

    Please note that, beginning with release 1.3.1, the above information about the necessity of setting the

    "java8.util.Spliterators.assume.oracle.collections.impl"

    property on Android to "false" is obsolete now.

    streamsupport-1.3.1 (and higher) can be used on Android without setting any special property.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.