尝试构建用于生产的本机React(运行./gradlew assembleRelease)时出现以下错误,
...
/node_modules/react-native-mauron85-background-geolocation/android/common/src/oreo/java/com/marianhello/bgloc/NotificationHelper.java:4:错误:找不到符号 导入android.app.NotificationChannel; ^ 符号:类NotificationChannel 位置:包android.app
...
任务':react-native-mauron85-background-geolocation-common:compileOreoReleaseJavaWithJavac'的执行失败
以前有人遇到此错误吗?
答案 0 :(得分:0)
只要添加解决了我的问题的内容,以防有人遇到相同的问题。
扯掉很多头发后(尽管我没有头发),我找到了解决方案。不确定是否会为他人工作,您可以尝试一下。
在android/build.gradle
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
}
并确保已安装依赖项。