nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 696 forks source link

Execution failed for task ':react-native-mapbox-gl_maps:lintDebug'. #1734

Open brunosp-49 opened 1 year ago

brunosp-49 commented 1 year ago

Hi, I'm getting this problem:

* What went wrong:
Execution failed for task ':react-native-mapbox-gl_maps:lintDebug'.
                 Lint found errors in the project; aborting build.

                  Fix the issues identified by lint, or create a baseline to see only new errors:

                  android {
                      lint {
                          baseline = file("lint-baseline.xml")
                      }
                  }

                  For more details, see https://developer.android.com/studio/write/lint#snapshot

                  Lint found 2 errors, 51 warnings. First failure:

  C:\Users\santo\OneDrive\Documentos\Geobyte\geobyteMaps\node_modules\@react-native-mapbox-gl\maps\android\rctmgl\src\main\AndroidManifest.xml:3: Error: If you need access to FINE location, you must request both ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION [CoarseFineLocation]      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     Explanation for issues of type "CoarseFineLocation":
     If your app requires access to FINE location, on Android 12 and higher you
     must now request both FINE and COARSE. Users will have the option to grant
     only COARSE location. Ensure your app can work with just COARSE location.

I tryied almost everything to solve this problem, but notthing works, what can I do? My AndroidManifest.xml:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>

My build.gradle:

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
        kotlinVersion = "1.6.0"

        useMapLibre = false
        useCustomMapbox = false

                // Mapbox deps
        if (useCustomMapbox) {
            rnmbglMapboxLibs = {
                implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1'
                implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0'
                implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.8.0'
                implementation 'com.mapbox.mapboxsdk:mapbox-android-gestures:0.7.0'
            }

            rnmbglMapboxPlugins = {
                implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0'
                implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0'
                implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
            }
        }

        // MapLibre deps
        if (useMapLibre) {
            rnmbglMapboxLibs = {
                implementation ("org.maplibre.gl:android-sdk:9.2.1")
                implementation ("com.mapbox.mapboxsdk:mapbox-sdk-turf:5.8.0")
                implementation 'com.mapbox.mapboxsdk:mapbox-android-telemetry:6.1.0'
            }

            rnmbglMapboxPlugins = {
                implementation ("com.mapbox.mapboxsdk:mapbox-android-gestures:0.7.0")
                implementation ("com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.14.0")    {
                    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk'
                }
                implementation ("com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0")        {
                    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk'
                }
                implementation ("com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0") {
                    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk'
                }
            }
        }
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
    }

    allprojects {
    repositories {
        mavenCentral()
        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")
        }

        if (rootProject.ext.get('useCustomMapbox')) {
                maven {
                    url 'https://api.mapbox.com/downloads/v2/releases/maven'
                    authentication {
                        basic(BasicAuthentication)
                    }
                    credentials {
                    username = "mapbox"
                    password = "REPLACE WITH YOUR MAPBOX DOWNLOAD TOKEN"

                    }
                }
        }

        if (rootProject.ext.get('useMapLibre')) {
            maven {
                url = "https://dl.bintray.com/maplibre/maplibre-gl-native"
            }
        }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
}