【问题标题】:react-native-mauron85-background geolocation errorreact-native-mauron85-background 地理定位错误
【发布时间】:2018-12-10 07:39:16
【问题描述】:

尝试构建我的 react native 用于生产时出现以下错误(运行 ./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'执行失败

以前有人遇到过这个错误吗?

【问题讨论】:

  • 我有这个错误。你运气好吗?
  • 你找到解决办法了吗?
  • 你有什么例子吗,我有很多链接和示例,但找不到我应该调用哪个方法以及在哪里调用

标签: react-native react-native-android


【解决方案1】:

如果有人遇到同样的问题,只需添加解决我的问题的方法。

在撕掉了很多头发(虽然我没有)之后,我找到了一个解决方案。不知道是否会为别人工作,你可以试一试。

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"
}

并确保已安装依赖项。

【讨论】:

    猜你喜欢
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 2016-01-25
    • 1970-01-01
    • 2021-12-29
    • 2016-10-26
    • 1970-01-01
    相关资源
    最近更新 更多