Eas build fails with error Execution failed for task ':expo-splash-screen:compileReleaseKotlin'

huangapple go评论106阅读模式
英文:

Eas build fails with error Execution failed for task ':expo-splash-screen:compileReleaseKotlin'

问题

我正在尝试从React Native Expo应用程序创建一个APK文件,但在执行生成APK文件的命令(eas build)时,遇到以下错误:

> [stderr]
>
> 构建失败:发生异常。
>
> [stderr]
>
> * 出错原因:
>
> [stderr]
>
> 执行任务“:expo-splash-screen:compileReleaseKotlin”时失败。
>
> [stderr]
>
> > 在执行org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction时发生故障
>
> [stderr]
>
> > 编译错误。请参阅日志获取更多详细信息
>
> [stderr]
>
> * 尝试:
>
> [stderr]
>
> > 使用--stacktrace选项运行以获取堆栈跟踪。
>
> [stderr]
>
> > 使用--info或--debug选项运行以获取更多日志输出。
>
> [stderr]
>
> > 使用--scan运行以获取完整的洞察。
>
> [stderr]
>
> * 获取更多帮助,请访问https://help.gradle.org
>
> [stderr]
>
> 在6分32秒内构建失败
>
> 错误:Gradle构建失败,原因未知。有关更多信息,请参阅“Run gradlew”阶段的日志。

我认为错误可能来自app.json文件中的splash部分,但我看不出其中有什么问题。

{
  "expo": {
    "name": "Talky",
    "slug": "talky",
    "scheme": "com.bertdelaspeed.talky",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/Talky_logo.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/Talky_splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    }
  }
}

这是已安装的依赖项:
Eas build fails with error Execution failed for task ':expo-splash-screen:compileReleaseKotlin'

英文:

I am trying to create an APK from react native expo application but upon doing the command to generate the apk (eas build), I run into the following error :

> [stderr]
>
> FAILURE: Build failed with an exception.
>
> [stderr]
>
> * What went wrong:
>
> [stderr]
>
> Execution failed for task ':expo-splash-screen:compileReleaseKotlin'.
>
> [stderr]
>
> > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
>
> [stderr]
>
> > Compilation error. See log for more details
>
> [stderr]
>
> * Try:
>
> [stderr]
>
> > Run with --stacktrace option to get the stack trace.
>
> [stderr]
>
> > Run with --info or --debug option to get more log output.
>
> [stderr]
>
> > Run with --scan to get full insights.
>
> [stderr]
>
> * Get more help at https://help.gradle.org
>
> [stderr]
>
> BUILD FAILED in 6m 32s
>
> Error: Gradle build failed with unknown error. See logs for the "Run
> gradlew" phase for more information.

I thought the error could be from splash in the app.json file but I can't see what's wrong in it.

{
  "expo": {
    "name": "Talky",
    "slug": "talky",
    "scheme": "com.bertdelaspeed.talky",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/Talky_logo.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/Talky_splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    }

  }
}

Here are the dependencies installed :
Eas build fails with error Execution failed for task ':expo-splash-screen:compileReleaseKotlin'

答案1

得分: 0

我找到的解决方案是首先执行以下步骤:

  1. 运行命令:npx expo prebuild
    这将生成一个android目录

然后你可以执行以下步骤:

  1. 在Vs code中按下CTRL + SHIFT + F(或者搜索),搜索'expo-splash-screen'
    你应该在以下三个位置找到它:package.json、package-lock.json和node_modules

  2. 从这些位置的所有文件中删除它,然后再次运行你的构建命令。

英文:

The solution I figured out is to first do:

1. npx expo prebuild

That should generate an android directory then you can do

2. CTRL + SHIFT + F (in Vs code or Search) and search 'expo-splash-screen'

You should find it in 3 places:
package.json, package-lock.json and node_modules

3. Delete it from all of those places and run your build command again

答案2

得分: 0

这个问题可以通过升级到最新的expo版本或expo@~49.0.6来解决,而不需要使用expo prebuild。

来源

英文:

This can be fixed with out expo prebuild, by just upgrading to latest expo version or expo@~49.0.6

Source

huangapple
  • 本文由 发表于 2023年8月9日 02:28:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76862279.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定