美文网首页
flutter 混编xcode报错 "IPA processin

flutter 混编xcode报错 "IPA processin

作者: 扛支枪 | 来源:发表于2020-03-10 15:16 被阅读0次

如图:


图片.png

原因大概是flutter编译后生成的framework中包含x86架构,导致ipa导出失败。解决方法:

1.用xcode10应该可以(这个我没试,因为我没有xcode10)

2.xcode中加脚本自动去除多余架构,在这里添加,之前有脚本的回车放其他脚本后边(如果没有Run Script,点击下图左上角的+号添加即可)。(此方法以测试可用,然后方法2就是这个方法的手动版)

图片.png
图片.png

脚本如下:

# Type a script or drag a script file from your workspace to insert its path.
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"                                           

# This script loops through the frameworks embedded in the application and

# removes unused architectures.

find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK

do

FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)

FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"

echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS

do

echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"

lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"

EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")

done

echo "Merging extracted architectures: ${ARCHS}"

lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"

rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"

rm "$FRAMEWORK_EXECUTABLE_PATH"

mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

3.手动去除framework中的多余架构

出现此错误后点击文章开头图中的show logs,出现如图


图片.png

打开IDEDistribution.standard.log文件,从下往上找到这里


图片.png
发现是Flutter中的x86_64的问题,然后如图操作:
图片.png

打开文件夹后继续按照如下路径
你的app名.xcarchive/Products/Applications/你的app名.app/Frameworks/Flutter.framework
如图


图片.png

在此路径下执行此命令

lipo -remove x86_64 Flutter -o Flutter
图片.png

即可,然后回去organizer window中继续刚才未完成的流程,如果还有次问题,继续重复方法三种的步骤,看还有那个framework中有多余的架构,我这有5个,重复执行了5次才成功打包。所以还是方法2最爽。

出处:https://github.com/flutter/flutter/issues/42917

相关文章

网友评论

      本文标题:flutter 混编xcode报错 "IPA processin

      本文链接:https://www.haomeiwen.com/subject/gavwdhtx.html