Search code examples
iosxcodevisual-studio-app-center

AppCenter failed to get module and shows error 65


I am using Swift with CocoaPods and trying to build it in AppCenter.

I kept getting this failing log

    CompileSwift normal arm64 (in target 'Wundercast' from project 'Wundercast')
    cd /Users/runner/runners/2.165.2/work/1/s
    /Applications/Xcode_11.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-bc /Users/runner/runners/2.165.2/work/1/s/Wundercast/ViewController.swift /Users/runner/runners/2.165.2/work/1/s/Wundercast/Utils/Colors.swift /Users/runner/runners/2.165.2/work/1/s/Wundercast/AppDelegate.swift /Users/runner/runners/2.165.2/work/1/s/Wundercast/Controllers/ApiController.swift /Users/runner/runners/2.165.2/work/1/s/Wundercast/Utils/Appearance.swift -supplementary-output-file-map /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/supplementaryOutputs-8c8267 -target arm64-apple-ios10.1 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -I /Users/runner/Library/Developer/Xcode/DerivedData/Wundercast-ermhkmlzqioflkgqqzuvbqmqczqy/Build/Intermediates.noindex/ArchiveIntermediates/Wundercast/BuildProductsPath/Release-iphoneos -F /Users/runner/Library/Developer/Xcode/DerivedData/W...
/Users/runner/runners/2.165.2/work/1/s/Wundercast/ViewController.swift:30:8: error: no such module 'RxSwift'
import RxSwift
       ^

** ARCHIVE FAILED **


The following build commands failed:
    CompileSwift normal armv7
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    CompileSwift normal arm64
(4 failures)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65

With previous research, I have configured the project with xcworkspace, and appcenter-post-clone.sh to install CocoaPods.

Here is the test project link.

What should I do to fix this?


Solution

  • After a few tries with a blank project, it worked pretty well with the following appcenter-post-clone.sh

    #!/usr/bin/env bash
    
    echo "Uninstalling all CocoaPods versions"
    sudo gem uninstall cocoapods --all --executables
    
    COCOAPODS_VER=`sed -n -e 's/^COCOAPODS: \([0-9.]*\)/\1/p' Podfile.lock`
    
    echo "Installing CocoaPods version $COCOAPODS_VER"
    sudo gem install cocoapods -v $COCOAPODS_VER
    
    cd $APPCENTER_SOURCE_DIRECTORY
    pod install
    

    However, the original project still fails in the release mode even locally. At least I now know the problem has nothing to do with AppCenter, but rather has some issues with Xcode. By dragging the project files into a new Xcode project, it worked like charm.