android - react-native-geolocation-service 构建问题
问题描述
问题:
我有一个 react native 应用程序,我正在使用 react-native-geolocation-service。在 npm install 之后,我尝试使用那里的 android studio 构建项目它失败并导致我出现这样的错误。
错误:找不到符号变量 ActivityCompat
这是我的构建 Gradle 文件。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
我尝试了很多在 Internet 上找到解决此问题的方法,但我无法做到。那么有人可以帮我解决这个问题吗?谢谢
解决方案
react native 0.60+ 已迁移到 Android X 所以你需要在添加新库时将文件转换为 AndroidX 使用 jetifier
npm install --save-dev jetifier
npx jetify (may take a while)
npx react-native run-android
推荐阅读
- javascript - Arcgis js 4.11:如何将底图图层添加到底图库
- html - 主题颜色元标记不适用于特定颜色
- php - 如果 WooCommerce 商店和档案中没有评论,请删除评论星
- node.js - 在 POST 上处理请求但在 PATCH 上失败
- dita - 当上下文是主题或图像时,如何获取 DITA 图书地图中 mainbooktitle 元素的值?
- android - 在房间 android 中存储列表的最佳选择是什么
- c# - EF 中的插入语句有时有效,有时无效
- reactjs - 管理复杂的状态,这种方法有什么问题吗?
- html -
未在容器中心对齐
- primeng - 是否可以有条件地显示primeng工具提示?