You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在RN CLI项目中移除React-Native-Camera的录音权限

Fixing Unwanted Audio Permission Request in react-native-camera for Avatar Capture

Hey there! I totally get the frustration of seeing an audio permission popup when your app doesn't even need recording functionality. Let's walk through the steps to get rid of that once and for all.

First, you're already on the right track by setting captureAudio={false} on your RNCamera component—this tells the library not to use audio capture. But the issue likely comes from native platform configuration where the audio permission is still declared by default. Here's how to fix it for both Android and iOS:

Android Solution

  1. Open your project's android/app/src/main/AndroidManifest.xml file.
  2. First, make sure your root <manifest> tag includes the tools namespace (add this if it's missing):
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        package="com.yourappname">
    
  3. Add this line inside the <manifest> tag to explicitly remove the default RECORD_AUDIO permission that react-native-camera might be adding:
    <uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" />
    
  4. Clean and rebuild your Android project to apply the changes:
    cd android && ./gradlew clean && cd .. && npx react-native run-android
    

iOS Solution

  1. Navigate to ios/[YourAppName]/Info.plist (replace [YourAppName] with your actual app name).
  2. Look for the key NSMicrophoneUsageDescription—this is what triggers the microphone permission popup. Delete this entire entry (both the key and its value).
  3. Clean up your iOS dependencies and rebuild:
    cd ios && pod deintegrate && pod install && cd .. && npx react-native run-ios
    

Additional Checks

  • Double-check that your RNCamera component still has captureAudio={false} set (you already have this in your code, which is perfect).
  • If you're using an older version of react-native-camera, consider upgrading to the latest stable release—some older versions had bugs where captureAudio={false} didn't properly suppress the permission request.

That should do it! Your app will now only request camera permission, and the audio popup will be gone.

内容的提问来源于stack exchange,提问作者Bharath-CODER

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 19:03:12