[swift-users] Swift 3 Android hangs & crashes

Eric Wing ewmailing at gmail.com
Mon Oct 31 15:53:38 CDT 2016


Hello, I've been trying to get Swift 3 working on Android. (I
previously had Swift 2.x working.)

I have the baseline components built following the standard
Android/Swift instructions.

But when I go to make a trivial, but real Android
app (i.e. start in Java Activity and use JNI/LoadLibrary to get to
Swift), the Swift code seems to hang (freeze?) whenever my Swift code
calls print("foo").

Removing all print calls, allows my trivial code to run correctly. But in
slightly more complicated test programs (which call into other C
libraries), I'm getting program crashes. It looks like libc triggers
some kind of abort call in these cases. I know these C libraries work
in non-Swift cases.

My best guess right now is since Swift print() is also broken, I think
there might be some problem related to libc++ (and maybe its
interaction with libc) which is used in the build process. (The
Android NDK docs warn about std::cout buffering breaking if you have
multiple static linked libc++, but I'm not statically linking it.)

I'm currently using libc++_shared.
I updated my repo a few days ago which includes a fix for NDK r13
which I am using.


Does this problem ring a bell for anybody?
Or can somebody help me figure out how to start debugging this? I've
been trying a lot of different things behind the scenes, but I'm
starting to run out of ideas.

Thanks,
Eric


More information about the swift-users mailing list