Voice: Unable to build react-native-voice

Created on 5 Aug 2019  路  3Comments  路  Source: react-native-voice/voice

Question

Build fails after i run the command react-native run-android. Error details are attached. Please help on this.
React-native version : 0.60

image

Most helpful comment

React-native version 0.60.x uses Androidx, you can replace the import android.support.annotation.NonNull with androidx.annotation.NonNull

All 3 comments

React-native version 0.60.x uses Androidx, you can replace the import android.support.annotation.NonNull with androidx.annotation.NonNull

Thank you. its working after the above change.

You can add this code into app/build.gradle file to resolve this issue automatically on every build.

task fixReactNativeVoiceImport() {
    def libModule = file("../../node_modules/react-native-voice/android/src/main/java/com/wenkesj/voice/VoiceModule.java")
    def fixedText = libModule.text.replace('android.support.annotation.NonNull', 'androidx.annotation.NonNull')
    libModule.write(fixedText)
}

preBuild.dependsOn fixReactNativeVoiceImport

Hope it will be helpful for someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dung-nguyentien picture dung-nguyentien  路  9Comments

inglesuniversal picture inglesuniversal  路  8Comments

MiguelGrability picture MiguelGrability  路  8Comments

Fistynuts picture Fistynuts  路  7Comments

B4ckes picture B4ckes  路  5Comments