Skip to content

copySwiftStdlib FAILURE: Build failed with an exception #1

Open

Description

@liufsd
14:37:50.556 [ERROR] [org.gradle.BuildExceptionReporter]
14:37:50.557 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:37:50.557 [ERROR] [org.gradle.BuildExceptionReporter]
14:37:50.557 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:37:50.557 [ERROR] [org.gradle.BuildExceptionReporter] Could not determine the dependencies of task ':copySwiftStdlib'.
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter] > Ambiguous method overloading for method java.io.File#<init>.
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter]   Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter]    [class java.lang.String]
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter]    [class java.net.URI]
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter]
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
14:37:50.558 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
14:37:50.559 [LIFECYCLE] [org.gradle.BuildResultLogger]
14:37:50.559 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
14:37:50.559 [LIFECYCLE] [org.gradle.BuildResultLogger]
14:37:50.559 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 4.119 secs

Activity

  1. liufsd commented on Apr 15, 2016

    @liufsd
    Author

    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'.

      Process 'command 'bash'' finished with non-zero exit value 1

    • 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).

  2. liufsd commented on Apr 15, 2016

    @liufsd
    Author

    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

  3. ephemer commented on Apr 15, 2016

    @ephemer
    Member

    @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.

  4. liufsd commented on Apr 16, 2016

    @liufsd
    Author

    @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.

  5. ephemer commented on Apr 16, 2016

    @ephemer
    Member

    @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.

  6. ephemer commented on Apr 16, 2016

    @ephemer
    Member

    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

  7. liufsd commented on Apr 16, 2016

    @liufsd
    Author

    yes.thanks. i have found this :https://github.com/apple/swift/blob/master/docs/Android.md
    I will try it ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions