Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Problema ao rodar o comando run-android

Boa noite,

Estou enfrentando problema ao rodar o comando run-android no windows 10.

No emulador abre uma tela vermelha com as informações abaixo:

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false

Body:
{"originModulePath":"D:\\www\\react-native\\InstaluraMobile\\index.js","targetModuleName":"@babel/runtime/helpers/interopRequireDefault","message":"Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `D:\\www\\react-native\\InstaluraMobile\\index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.","errors":[{"description":"Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `D:\\www\\react-native\\InstaluraMobile\\index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`."}],"name":"Error","stack":"Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `D:\\www\\react-native\\InstaluraMobile\\index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.\n    at ModuleResolver.resolveDependency (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:209:1301)\n    at ResolutionRequest.resolveDependency (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:83:16)\n    at DependencyGraph.resolveDependency (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:238:485)\n    at Object.resolve (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\lib\\transformHelpers.js:180:25)\n    at dependencies.map.result (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:311:29)\n    at Array.map (<anonymous>)\n    at resolveDependencies (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:307:16)\n    at D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:164:33\n    at Generator.next (<anonymous>)\n    at step (D:\\www\\react-native\\InstaluraMobile\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:266:307)"}
processBundleResult
    BundleDownloader.java:296
access$200
    BundleDownloader.java:37
onResponse
    BundleDownloader.java:174
execute
    RealCall.java:153
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1113
run
    ThreadPoolExecutor.java:588
run
    Thread.java:818
3 respostas

Tentei também recriar o app com uma versão anterior do react native ( react-native init InstaluraMobile --version 0.55.4) e ocorreu outro problema.

app:installDebug FAILEDnstallDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to finalize session : -26: Package com.instaluramobile new target SDK 22 doesn't support runtime permissions but the old target SDK 26 does.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 47.066 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Fala Leonardo, tudo bem ?

Você completou todos os passos do item de preparação de ambiente ? A versão correta do sdk (level 23) foi baixada completamente ao configurar o Android Studio?

Dei uma pesquisada por aqui e achei poucas referências ao problemas reportado. Uma delas cita problemas no mecanismo de concessão de permissões do usuário em determinados targetSdkVersion. Principalmente em casos onde o target sdk leva em conta versões mais antigas do Android.

Você poderia verificar qual targetSdkVersion está sendo considerada no processo de build da sua app ? Eh só procurar o valor dessa propriedade no arquivo > SeuProjetoReactNative/android/app/build.gradle.

Tente colocar aqui também a conteúdo gerado ao rodar o comando react-native info, para ter uma noção geral sobre o seu ambiente de desenvolvimento.

solução!

Boa tarde Rafael,

Consegui fazer rodar criando o projeto utilizando o yarn.

Obrigado.