原生项目升级助手

编辑页面

查看将原生项目升级到下一个 Expo SDK 版本所需的所有更改的逐文件差异。


For the complete documentation index, see llms.txt. Use this file to discover all available pages.

If you manage your native projects (android and ios directories), to 升级到最新的 Expo SDK, you have to make changes to your native projects. It can be a complex process to find which native file changes and what to update in which file.

以下指南提供了用于比较你项目当前 SDK 版本和你想升级到的目标 SDK 版本之间原生项目文件差异的 diff。你可以根据项目所使用的 expo 包版本,使用它们对项目进行修改。本页中的工具与 React Native Upgrade Helper 类似。不过,它们是围绕使用 Expo 模块及相关工具链的项目设计的。

想要完全避免升级原生代码?请查看 Continuous Native Generation (CNG),了解 Expo Prebuild 如何在构建前生成你的原生项目。

升级原生项目文件

一旦你升级了 Expo SDK 版本和相关依赖,请使用下面的 diff 工具了解你需要对原生项目做出的更改,并使其与当前 Expo SDK 版本保持一致。

选择你的起始 SDK 版本目标 SDK 版本以查看生成的 diff。然后,通过复制粘贴或手动修改项目文件,将这些更改应用到你的原生项目中。

From SDK version:

To SDK version:

Native code changes from SDK 55 to 56

1212*.hprof
1313.cxx/
1414
15# generated inline modules
16app/src/main/java/inline/
17
1518# Bundle artifacts
1619*.jsbundle
11distributionBase=GRADLE_USER_HOME
22distributionPath=wrapper/dists
3distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
3distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44networkTimeout=10000
55validateDistributionUrl=true
66zipStoreBase=GRADLE_USER_HOME
android/gradlew
MODIFIED
114114 NONSTOP* ) nonstop=true ;;
115115esac
116116
117CLASSPATH="\\\"\\\""
118117
119118
120119# Determine the Java command to use to start the JVM.
172171# For Cygwin or MSYS, switch paths to Windows format before running java
173172if "$cygwin" || "$msys" ; then
174173 APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175 CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176174
177175 JAVACMD=$( cygpath --unix "$JAVACMD" )
178176
205203DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206204
207205# Collect all arguments for the java command:
208# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
206# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209207# and any embedded shellness will be escaped.
210208# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211209# treated as '${Hostname}' itself on the command line.
212210
213211set -- \
214212 "-Dorg.gradle.appname=$APP_BASE_NAME" \
215 -classpath "$CLASSPATH" \
216213 -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217214 "$@"
218215
1@REM Copyright (c) Meta Platforms, Inc. and affiliates.
2@REM
3@REM This source code is licensed under the MIT license found in the
4@REM LICENSE file in the root directory of this source tree.
5
16@rem
27@rem Copyright 2015 the original author or authors.
38@rem
7075:execute
7176@rem Setup the command line
7277
73set CLASSPATH=
7478
7579
7680@rem Execute Gradle
77"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
81"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7882
7983:end
8084@rem End local scope for the variables with windows NT shell
248248 "FB_SONARKIT_ENABLED=1",
249249 );
250250 INFOPLIST_FILE = HelloWorld/Info.plist;
251 IPHONEOS_DEPLOYMENT_TARGET = 15.1;
251 IPHONEOS_DEPLOYMENT_TARGET = 16.4;
252252 LD_RUNPATH_SEARCH_PATHS = (
253253 "$(inherited)",
254254 "@executable_path/Frameworks",
255255 );
256 MACOSX_DEPLOYMENT_TARGET = 13.4;
256257 MARKETING_VERSION = 1.0;
257258 OTHER_LDFLAGS = (
258259 "$(inherited)",
275276 CLANG_ENABLE_MODULES = YES;
276277 CURRENT_PROJECT_VERSION = 1;
277278 INFOPLIST_FILE = HelloWorld/Info.plist;
278 IPHONEOS_DEPLOYMENT_TARGET = 15.1;
279 IPHONEOS_DEPLOYMENT_TARGET = 16.4;
279280 LD_RUNPATH_SEARCH_PATHS = (
280281 "$(inherited)",
281282 "@executable_path/Frameworks",
282283 );
284 MACOSX_DEPLOYMENT_TARGET = 13.4;
283285 MARKETING_VERSION = 1.0;
284286 OTHER_LDFLAGS = (
285287 "$(inherited)",
341343 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
342344 GCC_WARN_UNUSED_FUNCTION = YES;
343345 GCC_WARN_UNUSED_VARIABLE = YES;
344 IPHONEOS_DEPLOYMENT_TARGET = 15.1;
346 IPHONEOS_DEPLOYMENT_TARGET = 16.4;
345347 LD_RUNPATH_SEARCH_PATHS = (
346348 /usr/lib/swift,
347349 "$(inherited)",
393395 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
394396 GCC_WARN_UNUSED_FUNCTION = YES;
395397 GCC_WARN_UNUSED_VARIABLE = YES;
396 IPHONEOS_DEPLOYMENT_TARGET = 15.1;
398 IPHONEOS_DEPLOYMENT_TARGET = 16.4;
397399 LD_RUNPATH_SEARCH_PATHS = (
398400 /usr/lib/swift,
399401 "$(inherited)",
ios/Podfile
MODIFIED
1313end
1414
1515ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] ||= podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
16ENV['RCT_USE_RN_DEP'] ||= '1' if podfile_properties['ios.buildReactNativeFromSource'] != 'true'
17ENV['RCT_USE_PREBUILT_RNCORE'] ||= '1' if podfile_properties['ios.buildReactNativeFromSource'] != 'true'
16ENV['RCT_USE_RN_DEP'] ||= podfile_properties['ios.buildReactNativeFromSource'] == 'true' ? '0' : '1'
17ENV['RCT_USE_PREBUILT_RNCORE'] ||= podfile_properties['ios.buildReactNativeFromSource'] == 'true' ? '0' : '1'
1818ENV['RCT_HERMES_V1_ENABLED'] ||= '1' if podfile_properties['expo.useHermesV1'] == 'true'
19platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'
19ENV['EXPO_USE_PRECOMPILED_MODULES'] ||= '1' if podfile_properties['EXPO_USE_PRECOMPILED_MODULES'] != 'false'
20platform :ios, podfile_properties['ios.deploymentTarget'] || '16.4'
2021
2122prepare_react_native_project!
2223
package.json
MODIFIED
22 "name": "expo-template-bare-minimum",
33 "description": "This bare project template includes a minimal setup for using unimodules with React Native.",
44 "license": "0BSD",
5 "version": "55.0.38",
5 "version": "56.0.16",
66 "main": "index.js",
77 "scripts": {
88 "start": "expo start --dev-client",
1111 "web": "expo start --web"
1212 },
1313 "dependencies": {
14 "expo": "~55.0.26",
15 "expo-status-bar": "~55.0.6",
16 "react": "19.2.0",
17 "react-native": "0.83.6"
14 "expo": "~56.0.2",
15 "expo-status-bar": "~56.0.4",
16 "react": "19.2.3",
17 "react-native": "0.85.3"
18 },
19 "publishConfig": {
20 "executableFiles": [
21 "./android/gradlew"
22 ]
1823 }
1924}
2025