简体   繁体   English

react-native-geolocation-service 构建问题

[英]react-native-geolocation-service build issue

Problem:问题:

I have a react native application, there I am using react-native-geolocation-service.我有一个 react native 应用程序,在那里我使用的是 react-native-geolocation-service。 After having npm install I tried to build the project using The android studio in there It failed and led me to an error like this.安装 npm 后,我尝试使用其中的 android studio 构建项目失败并导致我出现这样的错误。

error: cannot find symbol variable ActivityCompat错误:找不到符号变量 ActivityCompat

This is my build Gradle file.这是我的构建 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' }
    }
}

I tried a lot to find a solution to this problem on the Internet but I was not able to do so.我尝试了很多在 Internet 上找到解决此问题的方法,但我无法这样做。 So can someone help me to solve this issue?那么有人可以帮我解决这个问题吗? Thank you谢谢

react native 0.60+ is migrated to Android X So you need to convert files into AndroidX when add new library use jetifier for this react native 0.60+ 迁移到 Android X 所以你需要在添加新库时将文件转换成 AndroidX 使用 jetifier 为此

npm install --save-dev jetifier
npx jetify (may take a while)
npx react-native run-android 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM