Voice: Not working on Android 11

Created on 26 Apr 2021  路  5Comments  路  Source: react-native-voice/voice

I have issue speech not working on android 11. Permission is granted but Voice.isAvailable alway false and speech not working.
Please fix this bug or give me any solution! Thanks

Most helpful comment

https://developer.android.com/about/versions/11/privacy/package-visibility

Due to Android 11 change, you have to add below code in your manifest xml file.

<manifest...>
    <queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
    </queries>
   ...

All 5 comments

https://developer.android.com/about/versions/11/privacy/package-visibility

Due to Android 11 change, you have to add below code in your manifest xml file.

<manifest...>
    <queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
    </queries>
   ...

Thank you boolgom! My issue was resolved by your solution!

Related to #304 #350

Thank you @boolgom! The issue specific to Android 11 was resolved by your solution!

Hi @boolgom

I'm facing the below issue while running the code. I just upgrade to android 11. Is the anything I missed, please help if any finding

error: unexpected element queries found in manifest application

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 16
        compileSdkVersion = 30
        targetSdkVersion = 30
        googlePlayServicesVersion = "+"
        firebaseVersion = "+"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.2")
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        // 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://www.jitpack.io' }
    }
}

Added below code in the AndroidManifest.xml file

<!-- Image capture & Speech to Text fixes -->
      <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
      </queries>

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alvaro1728 picture alvaro1728  路  5Comments

blackcoudpm picture blackcoudpm  路  8Comments

under94 picture under94  路  7Comments

alvaro1728 picture alvaro1728  路  3Comments

MrHazimAli picture MrHazimAli  路  7Comments