首页 > 解决方案 > 如何在 Expo 中创建 react-native apk?

问题描述

我想创建我的项目应用程序的 APK 文件。我正在处理这个世博会文档 但每次都失败了在此处输入图像描述

它给出了这个错误,无法进行构建。

 Copying resources from program jar [/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/mergeJavaRes/release/0.jar] (filtered)
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.e.ej$a.a(long, byte)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.o.gu$a.a(long, byte)`
> Task :app:transformClassesWithDexBuilderForRelease
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.q.gc$a.a(long, byte)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `io.branch.referral.Branch` was not found, it is required for default or static interface methods desugaring of `void host.exp.exponent.b.a.a(android.app.Application)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `org.slf4j.impl.StaticLoggerBinder` was not found, it is required for default or static interface methods desugaring of `void org.b.c.c()`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.ads.cnv$b.a(long, byte)`
> Task :app:transformDexArchiveWithDexMergerForRelease
> Task :app:mergeReleaseJniLibFolders
> Task :app:transformNativeLibsWithMergeJniLibsForRelease
> Task :app:packageRelease FAILED
1605 actionable tasks: 1605 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:packageRelease'.
[stderr] > com.android.ide.common.signing.KeytoolException: Failed to read key Techie@123 from store "/tmp/turtle/keystore-61d7d6e3-26f6-4954-b4a3-97305b4bfd3a.jks": No key with alias 'Techie@123' found in keystore /tmp/turtle/keystore-61d7d6e3-26f6-4954-b4a3-97305b4bfd3a.jks
[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 6m 44s
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>

标签: react-nativeexpo

解决方案


在终端/cmd 提示符中让 expo 服务器运行,如果没有工作,则expo start在另一个终端/cmd 提示符中运行expo build:android 尝试通过清除凭据运行来构建

世博会构建:android -c


推荐阅读