You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
copySwiftStdlib FAILURE: Build failed with an exception #1
i have install swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg and set my env "export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}""
then build your project success .
but app crash:
04-15 23:08:17.500 23094-23108/? E/art: Failed writing handshake bytes (-1 of 14): Broken pipe
04-15 23:08:17.645 23094-23094/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.zhuoweizhang.swifthello, PID: 23094
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/net.zhuoweizhang.swifthello-1/base.apk"],nativeLibraryDirectories=[/data/app/net.zhuoweizhang.swifthello-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libicudata.so"
at java.lang.Runtime.loadLibrary(Runtime.java:378)
at java.lang.System.loadLibrary(System.java:997)
at net.zhuoweizhang.swifthello.SwiftHello.loadNativeDependencies(SwiftHello.java:26)
at net.zhuoweizhang.swifthello.SwiftHello.onCreate(SwiftHello.java:15)
at android.app.Activity.performCreate(Activity.java:6100)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.access$1200(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5595)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
04-15 23:08:17.680 4351-4403/? E/ReportTools: This is not beta user build
@liufsd the two libicu libraries need to be copied into your APK bundle alongside libswiftCore.so and all other dynamic dependencies (that are listed elsewhere in the example code and instructions). Have a look at the other libicu issue for a workaround I found when your android system has a conflicting version of libicu already installed.
Not sure how we can help you beyond that, if that doesn't fix the issue maybe you can rephrase your question. I found it hard to follow all the stack dumps with no explanation.
Also note that the code from this Android port wasn't merged into swift master yet at the time of the 2016-03-01 snapshot, so I'd be surprised if it works on android at all.
@ephemer HI. how to get the libicu libraries ? you mean it need copy the libicu.so to the project libs(this project have libc++_shared.so libswifthello.so)?
I have try to build swift from swifandroid . But I don't know how to get the build result and use the result for my local env. I also have downloaded lasted pkg from swift.org .but build this sample fail(miss swiftc).so i have downloaded 3-1.pkg and build success. But run on the device crash.
@liufsd If it builds with an older version of swift it's probably for a generic version of Linux armv7 rather than for android specifically. Maybe that'd work too, I'm not sure but I'd guess not. At the moment you'll have to clone swift master and build swiftc yourself to get things working with android. I'd recommend waiting a week or two and getting a prebuilt snapshot with the android code compiled in.
When you do get that far you'll also need to package libswiftCore.so and some others. The android runtime linker will ask for them when trying to load your library if they're missing.
For libicu, look at GitHub.com/SwiftAndroid - there is a repo for libicu android. Again you'll have to build it yourself, there are instructions in that repo
Activity
liufsd commentedon Apr 15, 2016
Executing task ':compileSwift' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Starting process 'command 'bash''. Working directory: /Users/liupeng/Documents/workspace/GitHub/swift-android/swift-android-samples/swifthello/src/main/swift Command: bash -c SWIFTC="/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc-pm-android" swift build
Successfully started process 'command 'bash''
swift-build: error: system(["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swiftc", "--driver-mode=swift", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm", "-lPackageDescription", "-target", "x86_64-apple-macosx10.10", "/Users/liupeng/Documents/workspace/GitHub/swift-android/swift-android-samples/swifthello/src/main/swift/Package.swift", "-fileno", "3"], posix_spawn error: No such file or directory (2),
["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swiftc", "--driver-mode=swift", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm", "-lPackageDescription", "-target", "x86_64-apple-macosx10.10", "/Users/liupeng/Documents/workspace/GitHub/swift-android/swift-android-samples/swifthello/src/main/swift/Package.swift", "-fileno", "3"]):compileSwift FAILED
:compileSwift (Thread[main,5,main]) completed. Took 0.174 secs.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileSwift'.
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 4.071 secs
Stopped 0 compiler daemon(s).
liufsd commentedon Apr 15, 2016
i have install swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg and set my env "export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}""
then build your project success .
but app crash:
04-15 23:08:17.500 23094-23108/? E/art: Failed writing handshake bytes (-1 of 14): Broken pipe
04-15 23:08:17.645 23094-23094/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.zhuoweizhang.swifthello, PID: 23094
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/net.zhuoweizhang.swifthello-1/base.apk"],nativeLibraryDirectories=[/data/app/net.zhuoweizhang.swifthello-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libicudata.so"
at java.lang.Runtime.loadLibrary(Runtime.java:378)
at java.lang.System.loadLibrary(System.java:997)
at net.zhuoweizhang.swifthello.SwiftHello.loadNativeDependencies(SwiftHello.java:26)
at net.zhuoweizhang.swifthello.SwiftHello.onCreate(SwiftHello.java:15)
at android.app.Activity.performCreate(Activity.java:6100)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.access$1200(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5595)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
04-15 23:08:17.680 4351-4403/? E/ReportTools: This is not beta user build
ephemer commentedon Apr 15, 2016
@liufsd the two libicu libraries need to be copied into your APK bundle alongside libswiftCore.so and all other dynamic dependencies (that are listed elsewhere in the example code and instructions). Have a look at the other libicu issue for a workaround I found when your android system has a conflicting version of libicu already installed.
You already posted a comment in that thread: SwiftAndroid/swift#8
Not sure how we can help you beyond that, if that doesn't fix the issue maybe you can rephrase your question. I found it hard to follow all the stack dumps with no explanation.
Also note that the code from this Android port wasn't merged into swift master yet at the time of the 2016-03-01 snapshot, so I'd be surprised if it works on android at all.
liufsd commentedon Apr 16, 2016
@ephemer HI. how to get the libicu libraries ? you mean it need copy the libicu.so to the project libs(this project have libc++_shared.so libswifthello.so)?
I have try to build swift from swifandroid . But I don't know how to get the build result and use the result for my local env. I also have downloaded lasted pkg from swift.org .but build this sample fail(miss swiftc).so i have downloaded 3-1.pkg and build success. But run on the device crash.
ephemer commentedon Apr 16, 2016
@liufsd If it builds with an older version of swift it's probably for a generic version of Linux armv7 rather than for android specifically. Maybe that'd work too, I'm not sure but I'd guess not. At the moment you'll have to clone swift master and build swiftc yourself to get things working with android. I'd recommend waiting a week or two and getting a prebuilt snapshot with the android code compiled in.
When you do get that far you'll also need to package libswiftCore.so and some others. The android runtime linker will ask for them when trying to load your library if they're missing.
ephemer commentedon Apr 16, 2016
For libicu, look at GitHub.com/SwiftAndroid - there is a repo for libicu android. Again you'll have to build it yourself, there are instructions in that repo
liufsd commentedon Apr 16, 2016
yes.thanks. i have found this :https://github.com/apple/swift/blob/master/docs/Android.md
I will try it ~