fix: 修复 VideoBox 组件中对 imageRef 的访问,避免潜在的空引用错误;更新构建配置以临时禁用 Proguard 和资源缩减,解决内存占用问题;添加本地构建脚本

This commit is contained in:
康猛 2026-01-19 15:10:41 +08:00
parent f557fb74b3
commit 912c380a8a
3 changed files with 9 additions and 4 deletions

View File

@ -79,7 +79,7 @@ const VideoBox = ({ url, needWeb = true, width = 256, style, autoplay = true, ..
// 控制动画播放/停止
useEffect(() => {
if (imageRef.current) {
if (imageRef?.current) {
if (autoplay) {
imageRef.current?.startAnimating()
} else {

View File

@ -117,14 +117,16 @@ export default ({ config }) => {
useFrameworks: 'static',
},
android: {
enableProguardInReleaseBuilds: true,
enableShrinkResourcesInReleaseBuilds: true,
// 解决构建打包时webp导致内存占用过高临时禁用
enableProguardInReleaseBuilds: false,
enableShrinkResourcesInReleaseBuilds: false,
// 增加 Java 堆内存
packagingOptions: {
pickFirst: ['**/libc++_shared.so', '**/libjsc.so'],
},
// 设置 JVM 参数
jvmArgs: ['-Xmx4096m', '-XX:MaxMetaspaceSize=512m'],
jvmArgs: ['-Xmx4096m', '-XX:MaxMetaspaceSize=1024m'],
extraProguardRules: `-keep class com.tencent.mm.opensdk.** {
*;
}

View File

@ -24,6 +24,9 @@
"build:production:android": "eas build --profile production --platform android",
"update:test": "dotenv -e .env.test -- eas update --clear-cache --channel test",
"update:production": "dotenv -e .env.production -- eas update --clear-cache --channel production",
"build:local:development:android": "dotenv -e .env.development -- eas build --profile development --platform android --local",
"build:local:test:android": "dotenv -e .env.test -- eas build --profile test --platform android --local",
"build:local:production:android": "dotenv -e .env.production -- eas build --profile production --platform android --local",
"build:local": "eas build --profile production --local",
"check-types": "tsc --noEmit",
"lint": "expo lint",