【问题标题】:failed to run expo run:android未能运行博览会运行:android
【发布时间】:2021-08-03 18:20:58
【问题描述】:

我在尝试运行 expo run:android 时遇到此错误,但找不到任何解决方案。

> Task :app:compileDebugJavaWithJavac FAILED
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/generated/BasePackageList.java:1: error: illegal '.'
package com.mapsabad.profishop..generated;
                               ^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainApplication.java:1: error: <identifier> expected
package com.mapsabad.profishop.;
                               ^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainApplication.java:14: error: illegal '.'
import com.mapsabad.profishop..generated.BasePackageList;
                              ^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainActivity.java:1: error: <identifier> expected
package com.mapsabad.profishop.;
                               ^
/Users/amin/Projects/profishop/taksabad/android/app/src/debug/java/com/mapsabad/profishop/ReactNativeFlipper.java:7: error: <identifier> expected
package com.mapsabad.profishop.;
                               ^
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
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.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
519 actionable tasks: 3 executed, 516 up-to-date
/Users/amin/Projects/profishop/taksabad/android/gradlew exited with non-zero code: 1
Error: /Users/amin/Projects/profishop/taksabad/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (node:events:472:26)
    at ChildProcess.emit (node:events:365:28)
    at maybeClose (node:internal/child_process:1067:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
    ...
    at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at spawnGradleAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:44:18)
    at actionAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/runAndroid.ts:110:9)

我也尝试过 expo 弹出,然后运行 ​​npx react-native run-android 错误,我又遇到了同样的错误。

反应原生版本:0.63.4

有人想解决这个问题吗?

【问题讨论】:

  • 文字com.mapsabad.profishop.从何而来?这是您指定的值。它显然不应该在末尾有.,所以找到你指定值的位置,并删除.,然后问自己为什么首先在其中放置一个句点。

标签: java react-native gradle expo


【解决方案1】:

com.mapsabad.profishop. 中删除尾随句点,因为日志在多个地方表明这是一个错误。

【讨论】:

    【解决方案2】:

    就我而言,这是因为我在 ReactNativeFlipper 的包名称中包含“native”一词。认为它是从我的 app.json Expo 文件中的名称字段复制而来的。当我打开文件时,“native”这个词甚至被标记为红色文本,所以我通过重命名来解决它。

    【讨论】:

      猜你喜欢
      • 2019-05-23
      • 2023-02-25
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 2021-01-05
      • 2020-09-08
      • 1970-01-01
      • 2022-08-18
      相关资源
      最近更新 更多