jamsch / expo-speech-recognition

Speech Recognition for React Native Expo projects
MIT License
114 stars 11 forks source link

Example is not working #16

Open jorgtz opened 2 months ago

jorgtz commented 2 months ago

I have cloned this project, then cd into example, then npx expo start and got

expo-speech-recognition/example
Error: Cannot find module 'expo/config-plugins'

How to solve it? Also what node version is recommended for this project? Thanks!

jamsch commented 2 months ago

Hi @jorgtz, you'll need to run npm install in the root directory of the project if you haven't already. That should also build the module so that you can use it in the example app.

Also, since this contains a native module that isn't part of the Expo Go app, you'll need to run npm run android or npm run ios once to build and install the app on to your device, before using npm start

danny188 commented 1 month ago

I encountered the same error. The error is still there after I ran npm install

image

jamsch commented 1 month ago

Hey @danny188 Just to confirm: have you ran npm install inside both expo-speech-recognition-main\ and expo-speech-recognition-main\example\? I'll get a Windows machine to test it out soon.

danny188 commented 1 month ago

Hi @jamsch , I was able to build after running npm install inside expo-speech-recognition-main\ (previously only ran inside expo-speech-recognition-main\example\). I've now ran into some new errors when trying to test it on Android 9.

image

MINGW64 /c/local_documents/programming/expo/expo-speech-recognition-main/example
$ npx expo run:android
› Building app...
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
Configuration on demand is an incubating feature.
Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use 
versions of Android Studio and the command-line tools that were released at different times.

> Configure project :expo

Using expo modules
  - expo-asset (10.0.10)
  - expo-av (14.0.7)
  - expo-constants (16.0.2)
  - expo-file-system (17.0.1)
  - expo-font (12.0.10)
  - expo-keep-awake (13.0.2)
  - expo-modules-core (1.12.24)
  - expo-speech-recognition (0.2.21)
  - expo-splash-screen (0.27.5)

> Task :expo-file-system:processDebugManifest
C:\local_documents\programming\expo\expo-speech-recognition-main\example\node_modules\expo-file-system\android\src\main\AndroidManifest.xml:6:9-8:20 Warning 
        provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:6 to replace other declarations but no 
other declaration present

> Task :expo-modules-core:processDebugManifest
C:\local_documents\programming\expo\expo-speech-recognition-main\example\node_modules\expo-modules-core\android\src\main\AndroidManifest.xml:8:9-11:45 Warning:
        meta-data#com.facebook.soloader.enabled@android:value was tagged at AndroidManifest.xml:8 to replace other declarations but no other declaration present

> Task :app:processDebugMainManifest
C:\local_documents\programming\expo\expo-speech-recognition-main\example\android\app\src\debug\AndroidManifest.xml:6:5-162 Warning:
        application@android:usesCleartextTraffic was tagged at AndroidManifest.xml:6 to replace other declarations but no other declaration present
C:\local_documents\programming\expo\expo-speech-recognition-main\example\android\app\src\debug\AndroidManifest.xml Warning:
        provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:0 to replace other declarations but no 
other declaration present

> Task :expo-modules-core:compileDebugKotlin
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt:20:26 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead       
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt:63:51 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead       
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt:90:54 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead       
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt:6:34 'ReactFeatureFlags' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt:70:12 'ReactFeatureFlags' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt:97:7 'constructor Event<T : Event<(raw) Event<*>>!>(Int)' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt:44:17 'get(String!): Any?' is deprecated. Deprecated in Java

> Task :expo-modules-core:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :expo-splash-screen:compileDebugKotlin
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-splash-screen/android/src/main/java/expo/modules/splashscreen/SplashScreenViewController.kt:42:5 Parameter 'failureCallback' is never used
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-splash-screen/android/src/main/java/expo/modules/splashscreen/singletons/SplashScreenStatusBar.kt:16:27 'replaceSystemWindowInsets(Int, Int, Int, Int): WindowInsets' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-splash-screen/android/src/main/java/expo/modules/splashscreen/singletons/SplashScreenStatusBar.kt:17:29 'getter for systemWindowInsetLeft: Int' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-splash-screen/android/src/main/java/expo/modules/splashscreen/singletons/SplashScreenStatusBar.kt:19:29 'getter for systemWindowInsetRight: Int' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-splash-screen/android/src/main/java/expo/modules/splashscreen/singletons/SplashScreenStatusBar.kt:20:29 'getter for systemWindowInsetBottom: Int' is deprecated. Deprecated in Java

> Task :expo-av:compileDebugKotlin
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/ViewUtils.kt:10:26 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/ViewUtils.kt:19:129 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/ViewUtils.kt:21:78 'resolveView(Int): View?' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/ViewUtils.kt:39:111 'Promise' is deprecated. AsyncFunction will crash when called. Use expo.modules.kotlin.Promise instead
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/ViewUtils.kt:52:78 'resolveView(Int): View?' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/player/datasource/CustomHeadersOkHttpDataSourceFactory.kt:32:12 'constructor OkHttpDataSource(Call.Factory, String?, CacheControl?, HttpDataSource.RequestProperties?)' is 
deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/progress/AndroidLooperTimeMachine.kt:8:5 'constructor Handler()' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo-av/android/src/main/java/expo/modules/av/video/VideoViewModule.kt:64:17 'tryRunWithVideoView(ModuleRegistry, Int, ViewUtils.VideoViewCallback, Promise): Unit' is deprecated. Use `dispatchCommands` in favor of finding view with imperative calls

> Task :expo-av:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :expo:compileDebugKotlin
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt:20:34 'ReactFeatureFlags' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt:153:11 'ReactFeatureFlags' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt:161:34 'constructor ReactDelegate(Activity!, ReactNativeHost!, String?, Bundle?)' is deprecated. Deprecated in Java
w: file:///C:/local_documents/programming/expo/expo-speech-recognition-main/example/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt:231:10 'ReactFeatureFlags' is deprecated. Deprecated in Java

BUILD SUCCESSFUL in 3m 33s
260 actionable tasks: 182 executed, 69 from cache, 9 up-to-date
Starting Metro Bundler
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀▀▄▄█▄█▄█▄▀▀█ ██▀▀█▀█ ▄▄▄▄▄ █
█ █   █ ███▄█  ▀█▄▀ ██ ▄█▀ █▄▀█ █   █ █
█ █▄▄▄█ ██▄▀▄▀████▀█▄▀▀█▀▀█▄█ █ █▄▄▄█ █
█▄▄▄▄▄▄▄█ █ ▀▄▀▄█▄█▄▀▄█ ▀▄▀▄▀ █▄▄▄▄▄▄▄█
█▄▄█▄▄▀▄▀█▄▄▄ ██▀▀ ▀ ▄██▀█▀ ▀ █▄▀▀▀██▄█
█▀████▀▄▄▀▄  ▀▄█▄   ▀▀▄▀ ██▀ █ ▀▄█▀▀▀▄█
█▄▀ ▄▀█▄▄█▄▀ ▀█▄ ████▀▀█ ▄▀█▀ ▀▄▄▀ ▀███
█▀█▄   ▄▀█ ▀█ ▄▀ ▄█▀ ▄▄██▄▄▀ ██▄▀▀▀▀▀▄█
█ █ ▀█ ▄▀▄ ██▀ ▄▄█▀█ ▄█ ▄▄ █▀█▀▄▀█  ▀██
█ ▄▀█▄▄▄█▄  ▄ ▀▀ ▄▄▀ ▄▄▀▄█ ▀▄█▀ █  ▄█ █
█   ▀▄ ▄▀▀▀ ▀▀██ ▀▄█ ▄▀▀  █ ▀▄▄▄  ▀▀▀▄█
██▀█ ▄▄▄ ██▄  ▄▄▄▄  ▀ █ ▄██▀▄█▄▄█▄▀▀▀ █
█ █▄▀  ▄ ▄▄▄▀▀▀▄ ▄█ █▄█▀▀▄█▄ ▀█▄█▀ ▀ ██
█ ▄▀▀█▀▄█ █ █▀▄▀ ▄██▄▄▄▀█ █▀▄▀ ██     █
█▄███▄▄▄▄    ▄ ▄▄█▀▄▀ ▀▀▄█ ▄█ ▄▄▄   ▀▄█
█ ▄▄▄▄▄ ██▀█ ▀▀▀ ▄█▄ ▀▄▀▄ ▀█▀ █▄█ ▀▄█▄█
█ █   █ █ █▄▀▀██ ▀█▀▀██▀ █▀▀▄▄   ▄█▀▄▄█
█ █▄▄▄█ █▀▄  ██▀▄▄ ▄█ ██ █▄▀█▄▄▀▄ █ ▀ █
█▄▄▄▄▄▄▄█▄▄▄▄▄█▄▄▄█▄█▄██▄▄███▄████▄██▄█

› Metro waiting on expo.modules.speechrecognition.example://expo-development-client/?url=http%3A%2F%2F192.168.20.5%3A8081
› Scan the QR code above to open the project in a development build. Learn more: https://expo.fyi/start

› Web is waiting on http://localhost:8081

› Using development build
› Press s │ switch to Expo Go

› Press a │ open Android
› Press w │ open web

› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu
› Press o │ open project code in your editor

› Press ? │ show all commands

› Opening on Android...
CommandError: No development build (expo.modules.speechrecognition.example) for this project is installed. Please make and install a development build on the device first.
Learn more: https://docs.expo.dev/development/build/
› Opening expo.modules.speechrecognition.example://expo-development-client/?url=http%3A%2F%2F192.168.20.5%3A8081 on SM_G9550

› Logs for your project will appear below. Press Ctrl+C to exit.
Android Bundled 5908ms C:\local_documents\programming\expo\expo-speech-recognition-main\example\node_modules\expo\AppEntry.js (1259 modules)
 (NOBRIDGE) LOG  Bridgeless mode is enabled
 (NOBRIDGE) ERROR  Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at App (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129634:41)
    at withDevTools(App) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129415:27)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at AppContainer (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68299:25)
    at main(RootComponent) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:116635:28)
 (NOBRIDGE) ERROR  Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at App (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129634:41)
    at withDevTools(App) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129415:27)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at AppContainer (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68299:25)
    at main(RootComponent) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:116635:28)
 (NOBRIDGE) ERROR  Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at App (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129634:41)
    at withDevTools(App) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129415:27)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at AppContainer (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68299:25)
    at main(RootComponent) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:116635:28)
 (NOBRIDGE) ERROR  Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at App (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129634:41)
    at withDevTools(App) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129415:27)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at RCTView
    at View (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68456:43)
    at AppContainer (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:68299:25)
    at main(RootComponent) (http://localhost:8081/node_modules/expo/AppEntry.bundle//&platform=android&dev=true&lazy=true&minify=false&app=expo.modules.speechrecognition.example&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:116635:28)
 (NOBRIDGE) ERROR  TypeError: Cannot read property 'useRef' of null

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)
 (NOBRIDGE) ERROR  TypeError: Cannot read property 'useRef' of null

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)
jamsch commented 1 month ago

@danny188 The Cannot read property 'useRef' of null error usually has something to do with how the npm packages were installed. What npm/node versions are you running, and are you running npm install?

danny188 commented 1 month ago

Hi @jamsch , npm version 10.7.0 I have run npm install inside both expo-speech-recognition-main and expo-speech-recognition-main\example.

There was a npm error when I ran npm install inside expo-speech-recognition-main:

image

jamsch commented 1 month ago

@danny188 Unfortunately it seems like expo-module-scripts doesn't support Windows so I'm not sure what can be done there. I think the best luck you'll have running the example app is to do the following:

 "paths": {
      "expo-speech-recognition": ["../src/index"],
      "expo-speech-recognition/*": ["../src/*"]
    },
jamsch commented 1 month ago

@danny188 Also, I've just tested the permissions on an Android 9 emulator and it seems okay. I did have a slight bug on the example app where the state wasn't reset if the user denied permissions but I've pushed a small fix for that right now.

Screenshot 2024-10-01 at 4 48 58 PM
danny188 commented 1 month ago

@danny188 Unfortunately it seems like expo-module-scripts doesn't support Windows so I'm not sure what can be done there. I think the best luck you'll have running the example app is to do the following:

  • Remove example/metro.config.js
  • Remove the following from example/tsconfig.json:
 "paths": {
      "expo-speech-recognition": ["../src/index"],
      "expo-speech-recognition/*": ["../src/*"]
    },
  • Remove the "plugins" section from example/babel.config.js:
plugins: [
      [
        "module-resolver",
        {
          extensions: [".tsx", ".ts", ".js", ".json"],
          alias: {
            // For development, we want to alias the library to the source
            "expo-speech-recognition": path.join(
              __dirname,
              "..",
              "src",
              "index.ts",
            ),
          },
        },
      ],
    ],
  • Add "expo-speech-recognition": "0.2.21", under the "dependencies" section in example/package.json
  • Run npm install and then npm run android

@jamsch I was able to run the example app after your suggested changes :D Thanks!

WheelyWonka commented 1 day ago

Hello,

The example works perfectly on Android, but it seems impossible to make it run on iOS Simulator. After npm install from the root folder, cd example, npx expo run ios, i got this error after a long waiting time (it's huge so i put just the end of it, when it starts to say actually something in plain english):

note: Run script build phase '[Expo] Configure project' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'expospeechrecognitionexample' from project 'expospeechrecognitionexample')
note: Run script build phase 'Bundle React Native code and images' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'expospeechrecognitionexample' from project 'expospeechrecognitionexample')
warning: Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')

2024-11-15 22:12:32.040 xcodebuild[85514:1167571]  DVTAssertions: Warning in DVTiOSFrameworks/DTDeviceKitBase/DTDKRemoteDeviceData.m:409
Details:  (null) deviceType from aa5efcd9fcba65ef922beb89851f86637b1e8f03 was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7fcf4892e7e0>
Method:   -platform
Thread:   <NSThread: 0x6000001b9280>{number = 7, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2024-11-15 22:12:32.316 xcodebuild[85514:1167570]  DVTAssertions: Warning in DVTiOSFrameworks/DTDeviceKitBase/DTDKRemoteDeviceData.m:409
Details:  (null) deviceType from aa5efcd9fcba65ef922beb89851f86637b1e8f03 was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7fcf4892e7e0>
Method:   -platform
Thread:   <NSThread: 0x600000ef8040>{number = 8, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2024-11-15 22:12:32.401 xcodebuild[85514:1167570]  DVTAssertions: Warning in DVTiOSFrameworks/DTDeviceKitBase/DTDKRemoteDeviceData.m:409
Details:  (null) deviceType from aa5efcd9fcba65ef922beb89851f86637b1e8f03 was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7fcf4892e7e0>
Method:   -platform
Thread:   <NSThread: 0x600000ef8040>{number = 8, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:CA2EA330-174C-48E3-954A-626F3FC022D9, OS:17.2, name:iPhone SE (3rd generation) }
{ platform:iOS Simulator, id:CA2EA330-174C-48E3-954A-626F3FC022D9, OS:17.2, name:iPhone SE (3rd generation) }
** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution [CP-User]\ Generate\ app.config\ for\ prebuilt\ Constants.manifest /Users/XXXXXXX/Library/Developer/Xcode/DerivedData/expospeechrecognitionexample-afrcoiruenjjlzcpnupzftzijgjj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/EXConstants.build/Script-46EB2E00015F60.sh (in target 'EXConstants' from project 'Pods')
    Building workspace expospeechrecognitionexample with scheme expospeechrecognitionexample and configuration Debug
(2 failures)
Build logs written to /Users/XXXXXXX/Desktop/expo-speech-recognition/example/.expo/xcodebuild.log

Any thoughts ? Thank you very much !