【问题标题】:React native build error when I try to run 'npm run android'?当我尝试运行“npm run android”时反应原生构建错误?
【发布时间】:2021-12-28 02:18:22
【问题描述】:

我是 stackoverflow 的新手,所以我不知道如何以好的方式管理问题。很抱歉。


当我尝试运行 npx react-native run-android || npm run android,它会抛出这个错误?

> Task :app:processDebugMainManifest FAILED
[:react-native-firebase_app] /home/groot/ALL_MINE/REACT/REACT_NATIVE/EDesign/node_modules/@react-native-firebase/app/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml Warning:
        Package name 'io.invertase.firebase' used in: :react-native-firebase_app, :@react-native-firebase_app.
[com.google.android.ads.consent:consent-library:1.0.6] /home/groot/.gradle/caches/transforms-3/61220cba941701c55a6acecb5d3d8e99/transformed/jetified-consent-library-1.0.6/AndroidManifest.xml Warning:
        Package name 'com.google.android.ads.consent' used in: com.google.android.ads.consent:consent-library:1.0.6, com.google.android.ump:user-messaging-platform:1.0.0.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


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.9/userguide/command_line_interface.html#sec:command_line_warnings
132 actionable tasks: 2 executed, 130 up-to-date
/home/groot/ALL_MINE/REACT/REACT_NATIVE/EDesign/android/app/src/debug/AndroidManifest.xml:11:73-127 Error:
        Attribute meta-data#com.google.android.gms.ads.APPLICATION_ID@value value=(ca-app-pub-1030707148416513~6139129872) from AndroidManifest.xml:11:73-127
        is also present at [:invertase_react-native-google-ads] AndroidManifest.xml:16:13-29 value=().
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:11:5-129 to override.

FAILURE: Build failed with an exception.

怎么解决,我卡在这里了……

【问题讨论】:

  • 读取错误的最后 4 行。给出了解决方案
  • 我试过了,但它再次抛出下一个错误。在哪里添加工具:replace="android:value" ??

标签: android react-native


【解决方案1】:

您只需将您的 admob ApplicationId 添加到清单文件中。

<application>
    ***

     <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data  
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-3940256099942544~3347511713"
        tools:replace="android:value"/>

也别忘了加,

xmlns:tools="http://schemas.android.com/tools"

【讨论】:

    【解决方案2】:

    试试这个First React Native App: Task :app:processDebugMainManifest FAILED

    就我而言,Nicofisi 的回答有效:

    将以下行添加到项目中的 ./android/gradle.properties 文件中:

    org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED

    【讨论】:

      猜你喜欢
      • 2021-12-12
      • 1970-01-01
      • 2020-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-10
      • 2020-01-23
      • 1970-01-01
      相关资源
      最近更新 更多