Error while trying to run app in android studio emulator

Asked

Viewed 1,044 times

1

I’m trying to run the app in the emulator of Android Studio, at first the terminal seems to be all right:

D:\react-apps\teste>react-native run-android
Scanning 557 folders for symlinks in D:\react-apps\teste\node_modules (25ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reus
ed, use --status for details
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:app:prepareComFacebookFrescoDrawee101Library
:app:prepareComFacebookFrescoFbcore101Library
:app:prepareComFacebookFrescoFresco101Library
:app:prepareComFacebookFrescoImagepipeline101Library
:app:prepareComFacebookFrescoImagepipelineBase101Library
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:app:prepareComFacebookReactReactNative0471Library
:app:prepareComFacebookSoloaderSoloader010Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed,
no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithDexForDebug

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at le
ast 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environ
ment.html

:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:transformNativeLibsWithStripDebugSymbolForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_5X_API_24(AVD) - 7.0' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 58.863 secs
Running adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (adb -s emulator-5554 shell am start -n com.te
ste/com.teste.MainActivity)...
Starting: Intent { cmp=com.teste/.MainActivity }

D:\react-apps\teste>

But the emulator screen shows the error below:

inserir a descrição da imagem aqui

  • The packager terminal is opening automatically after you run "React-Native run-android" ?

  • It was not, now reinstalled everything from scratch and worked, I believe it was some dependency that was missing in the first installation

1 answer

1


This problem can be solved in 2 ways.

The first:

  • Create the folder Assets in the directory android/app/src/main/.

Open your terminal, point to the project root folder and run the following command:

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Second:

  • Edit the module version Babel-preset-React-Native for the version 2.1.0.

Just run the following commands in the root folder of your project.

yarn remove babel-preset-react-native
yarn add [email protected]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.