In my react-native application, I need to get location permission from the user, so I added this in one of the Activity classes...
public void onCreate() {
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
}
However, I get a cannot resolve symbol error
for both ActivityCompat
and Manifest
.
After doing some research I found out you need to add the following to the gradle.build
file compile 'com.android.support:support-v4:23.0.0'
So I did that...
dependencies {
compile project(':react-native-maps')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.android.support:support-v4:23.0.0'
}
But I still get the same errors. I tried clean
still nothing. I also tried restarting Android Studio File > Invalidate Caches/Restart
, still get the errors.
How do I fix these errors?
in gradle file set the latest API and build levels:
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
and use
compile 'com.android.support:appcompat-v7:+'
here you can use the other approach: https://stackoverflow.com/a/32062974/1979882
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With