当我尝试在我的 React Native 项目中构建 Android 应用程序时出现构建错误。
当我运行 react-native run-android
时,它说:
> Configure project :react-native-os
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.
在 Android Studio 中,我可以看到它说了同样的话: Cause: compileSdkVersion is not specified.
所以我在 Android Studio 中编辑了 build.gradle(Module: app) 文件,但问题仍然存在,并且错误消息没有改变。
android {
// compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
我在其他类似 的 线程中尝试了解决方案,但没有任何效果。有谁知道这里有什么问题?
原文由 sflow 发布,翻译遵循 CC BY-SA 4.0 许可协议
我也遇到了同样的问题:
1-在终端运行
npm i @react-native-firebase/app
2-按照 以下步骤 将 firebase 添加到 android 平台。