我正在尝试使用Expo构建Android独立应用,我按照this guide上的所有说明进行操作,直到我开始构建要发布的应用为止,一切正常。
我有这个错误。
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseResources'.
[stderr] > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
[stderr] /app/turtle/workingdir/android/sdk34/android-shell-app/app/src/main/res/mipmap-mdpi/ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 19s
729 actionable tasks: 729 executed
Error: ./gradlew exited with non-zero code: 1
at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
...
at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:235:45)
at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:881:11)
at <anonymous>
即使我确保图标为png,即使将assetBundlePatterns
更改为assets/*
,也尝试了this answer和{{ 3}},而this one even if it's not expo不起作用,因为它给出了此错误error: unknown option '-t'
。
我的app.json:
{
"expo": {
"name": "Name",
"slug": "nameslug",
"privacy": "public",
"sdkVersion": "34.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover",
"backgroundColor": "#00a43d"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"assets/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.nameslug.company",
"buildNumber": "1"
},
"android": {
"package": "com.nameslug.company",
"versionCode": 1
},
"description": "Tengeneza ankara zako kwa urahisi kwa kutumia App Hii",
"androidStatusBar": {
"backgroundColor": "#00a43d",
"barStyle": "dark-content",
"animated": true,
"translucent": true
}
}
}