【问题标题】:Expo EAS build failed because "plugin with id 'maven' not found" [react-native-google-nearby-messages]Expo EAS 构建失败,因为“找不到 id 为 \'maven\' 的插件”[react-native-google-nearby-messages]
【发布时间】:2023-02-03 22:08:49
【问题描述】:

我在 expo 中实现包含本机代码的 react-native-google-nearby-messages 包时遇到问题。 事实上,命令eas build --profile development --platform android 失败并出现一系列警告和错误。

博览医生:

Running "expo doctor"
- Finding all copies of expo-modules-autolinking
- Finding all copies of @expo/config-plugins
[stderr] [20:13:25] Expected package @expo/config-plugins@^5.0.0
[stderr] [20:13:25] Found invalid:
[stderr] [20:13:25]   @expo/config-plugins@4.1.5
[stderr] [20:13:25]   (for more info, run: npm why @expo/config-plugins)
- Finding all copies of @expo/prebuild-config
- Finding all copies of @unimodules/core
- Finding all copies of @unimodules/react-native-adapter
- Finding all copies of react-native-unimodules
Command "expo doctor" failed.
bash exited with non-zero code: 1

格拉德鲁:

[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/react-native-google-nearby-messages/android/build.gradle' line: 24
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':react-native-google-nearby-messages'.
[stderr] > Plugin with id 'maven' not found.
[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] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':react-native-google-nearby-messages'.
[stderr] > compileSdkVersion is not specified. Please add it to build.gradle
[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] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 49s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

这是我根据包请求实现的插件:

  const { AndroidConfig, withAndroidManifest } = require("@expo/config-plugins");
  const { addMetaDataItemToMainApplication, getMainApplicationOrThrow } =
    AndroidConfig.Manifest;
  
  module.exports = withMyCustomConfig = (config) => {
    return withAndroidManifest(config, async (config) => {
      // Modifiers can be async, but try to keep them fast.
      config.modResults = await setCustomConfigAsync(config, config.modResults);
      return config;
    });
  };
  
  // Splitting this function out of the mod makes it easier to test.
  async function setCustomConfigAsync(config, androidManifest) {
    const appId = "my-app-id";
    // Get the <application /> tag and assert if it doesn't exist.
    const mainApplication = getMainApplicationOrThrow(androidManifest);
  
    addMetaDataItemToMainApplication(
      mainApplication,
      // value for `android:name`
      "com.google.android.nearby.messages.API_KEY",
      // value for `android:value`
      "myabikey"
    );
  
    return androidManifest;
  }

老实说,我不知道这是否是正确的方法,非常欢迎提供帮助。提前致谢。

【问题讨论】:

    标签: javascript android react-native expo gradlew


    【解决方案1】:

    你能解决吗?我也有同样的问题

    【讨论】:

    • 请不要添加我也是作为答案。它实际上并没有提供问题的答案。如果您有不同但相关的问题,请ask它(如果它有助于提供上下文,请参考此问题)。如果你对这个具体问题感兴趣,你可以upvote它,留下comment,或者一旦你有足够的reputation就开始bounty
    猜你喜欢
    • 2023-02-25
    • 2021-11-08
    • 2021-11-25
    • 2022-10-08
    • 2022-06-28
    • 2022-06-23
    • 1970-01-01
    • 2018-10-31
    • 2022-12-22
    相关资源
    最近更新 更多