Problem Description
Updated FlutterSDK
, the emulator runs without problems, but the real machine crashes
The error result is as follows:
dyld[15588]:
Library not loaded: @rpath/App.framework/App
Referenced from:
/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Merchant
Reason: tried:
'/usr/lib/swift/App.framework/App' (no such file),
'/usr/lib/swift/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/usr/lib/swift/App.framework/App' (no such file),
'/usr/lib/swift/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/private/var/containers/Bundle/Application/42B64C9D-DDC4-4DF3-9287-068E4EE2EBDB/Merchant.app/Frameworks/App.framework/App' (no such file),
'/System/Library/Frameworks/App.framework/App' (no such file)
Cause Analysis:
After investigation, it was found that there was Flutter
no App.framework
import
Solution 1:
Open it Pods-xx-frameworks.sh
and add the following code
install_framework "${PODS_ROOT}/../merchant_flutter/.ios/Flutter/App.framework"
-
../merchant_flutter
This path can copyPodfile
the innerflutter_application_path
value -
xx: project name
-
There are disadvantages in this solution: after each project,
pod install
thePods-xx-frameworks.sh
file will be reset, and the added code will be deleted. Solution 2 can be adopted
Solution 2:
- open
TARGETS
->Build Phases
->+
->New Run Script Phase
- add command
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${
source}")"
fi
if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
# Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied
find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do
echo "Installing $f"
install_bcsymbolmap "$f" "$destination"
rm "$f"
done
rmdir "${source}/${BCSYMBOLMAP_DIR}"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${
RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
elif [ -L "${binary}" ]; then
echo "Destination binary is symlinked..."
dirname="$(dirname "${
binary}")"
binary="${dirname}/$(readlink "${
binary}")"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
install_framework "../merchant_flutter/.ios/Flutter/App.framework"