react-native run-androind giving error of 500 on first time - android

I just installed react native and created a fresh project, But when I'm running it by using react-native run-android command it is giving error. I didn't changed anything in any file the project is just created.
Here are the error and screenshot of it.
Error
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":"C:\project\test\App.js","targetModuleName":"./../../react-transform-hmr/lib/index.js","message":"Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'","errors":[{"description":"Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'"}],"name":"Error","stack":"Error: Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n at ModuleResolver.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:209:697)\n at ResolutionRequest.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:83:16)\n at DependencyGraph.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph.js:222:485)\n at Object.resolve (C:\project\test\node_modules\metro\src\lib\transformHelpers.js:149:25)\n at dependencies.map.result (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:316:29)\n at Array.map ()\n at resolveDependencies (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:312:16)\n at C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:169:33\n at Generator.next ()\n at step (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:271: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
Please help me get out of this...

Try these steps:
1- Clear the cache using:
rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*;
2 - If you are using the watchman, remove all watches and associated triggers with:
watchman watch-del-all
3 - Restart the Metro Bundler from the project folder
react-native start --reset-cache
4 - Run react-native run-android

I faced this problem before try this solutions,
1- Restart metro bundler with npm start
2- Restart project with different port react-native run-android --port=8088
Because sometimes default port 8081 may used by another app.

Related

Error: Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter

We created a ionic app with angular. When we use
ionic serve
Then its working fine.
But when we are generating android apk then we are getting this error:-
* Where:
Build file '/home/ankur/projects/ionicdesign/ionic-roots_v101/ionic
apps/kisansanchar/medical/platforms/android/app/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
Here is complete log details:-
Paste Bin
Any idea about this error?
I've had the same issue.
Digging into gradle command with --scan, I've found the problem.
My ~/.android was owned by root, so my build (launch by my user) failed to read/write into this directory.
Solution: sudo chown -R you:you ~/.android
For me, it was the kotlin_version in build.gradle, the one used for building is lower than what was configured for my IDE, so what I did is deleted my .gradle caches by typing this in terminal rm -rf $HOME/.gradle/caches/
Then restarted my project in my case it was a flutter project so flutter run is the command. everything is taken care of after that.

running npx update with error cannot find set-blocking

I tried using "npx update". I am at a total loss why i am getting this error and cannot seem to find even a starting point on this. The only thing I am using npx for is capacitor (with ionic framework). Any help on the reason for this or fixes or just being pointed in the right directions would help
C:\dev\p\bas>npx update
npx: installed 658 in 28.218s
[23:34:41] using file ~C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\lib\updatefile.js
[23:34:41] starting update.default
[23:34:41] √ running: init
Current updaters: init
no updaters were saved.
[23:34:42] finished update.default √ 410ms
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'set-blocking'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at process.<anonymous> (C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\bin\update.js:4:3)
at process.emit (events.js:203:15)
at process.exit (internal/process/per_thread.js:168:15)
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\bin\update.js:55:15
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\node_modules\base-generators\index.js:482:13
at C:\Users\Hunter\AppData\Roaming\npm-cache\_npx\6000\node_modules\update\node_modules\async-each-series\index.js:15:40
What helped resolve the error for me was updating my npm version first:
npm install -g npm#latest
npm install -g set-blocking
npx update
Just run the npm command to install the missing module:
npm install set-blocking
and then run npx update again
Hope it helps! :)

React Native Error: Module `ProgressBarAndroid` does not exist in the Haste module map

I created a React Native project on Windows 10 using create-react-native-app. Then I ran npm run eject to get a standard React Native application. For a few days, the application was working fine, running npm run android would display the application on my device correctlu. But after installing a few modules (react-native-app-auth, react-native-navigation), this error started popping up in the Node console whenever I tried to run the application, and is now constantly popping up in every project, even the new ones.
path\to\project\node_modules\react-native\Libraries\react-native\react-native-implementation.js`: Module `ProgressBarAndroid` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`. 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
at ModuleResolver.resolveDependency (C:\path\to\project\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:161:1460)
at ResolutionRequest.resolveDependency (C:\path\to\project\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:91:16)
at DependencyGraph.resolveDependency (C:\path\to\project\node_modules\metro\src\node-haste\DependencyGraph.js:272:4579)
at dependencies.map.relativePath (C:\path\to\project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:376:19)
at Array.map (<anonymous>)
at resolveDependencies (C:\path\to\project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:374:16)
at C:\path\to\project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:212:33
at Generator.next (<anonymous>)
at step (C:\path\to\project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:313)
at C:\path\to\project\node_modules\metro\src\DeltaBundler\traverseDependencies.js:297:473
BUNDLE [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
I tried following the instructions there, to no avail: https://github.com/facebook/react-native/issues/4968
I also tried following the instructions there (my issue doesn't seem related to theirs), to no avail: React native: Module `DrawerLayoutAndroid` does not exist in the Haste module map
If I do what is suggested in the only reply, then the same error appears but with a different native module, and if I keep removing the lines, it keeps popping up with a different module every time.
I also tried starting from scratch, creating a new project, using different versions of react-native, even reinstalling Node and npm entirely, but the error still pops up. The only way I found to make it work again is to start from scratch on another machine.
Thanks in advance.

Cannot Find entry file index.ios.js in any of the project roots ["/Users/neo/newProjects/F2"]

Actual Behavior
Instead of launching, I get a red screen and this error message when launching a react native projects from scratch: Cannot Find entry file index.ios.js in any of the project roots ["/Users/neo/newProjects/F2"]
Expected behavior
Launch of a clean app starter
What I am trying to do
I'm trying to init and run a react-native project from scratch in the android and ios simulator, but I'm getting the following error.
What I have tried
I've tried doing the following:
Install via documentation
Moving through the install steps outlined here several times:
https://facebook.github.io/react-native/docs/getting-started.html
NPM Install
Performing NPM Install from within the project folder
Editing .profiles ( android )
editing the ~.profiles file, to set the android home variable.. this is what it looks like now:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" $
export ANDROID_HOME=${HOME}/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools`
Npm start
Running npm start and checking activity on the port, ( was the package manager running )
checking the port for activity
( forget how, verified its available )
Code that worked for someone...
I have also tried running this code in the terminal
react-native bundle \
--entry-file=index.ios.js \
--platform=ios \
--dev=false \
--assets-dest=./production/ios \
--bundle-output=./production/ios/ios.jsbundle
After reviewing this article https://github.com/facebook/react-native/issues/8664
And got this error message:
ENOENT: no such file or directory, open './production/ios/ios.jsbundle'
I noticed this suggestion
rerunning npm install and rnpm link
I tried running rnpm link, but got "no such command found"
after reading this article
Entry file error in react native from packager
In the same article I saw this:
"Figured out that after updating to RN 0.28 my app is spitting this issue due to incompatible dependencies. This is how I solved this problem"
rm -rf node_modules
npm cache clean
Then open package.json except react-native change all package versions to *
Then run
npm update --save
npm update --save-dev
Check package if package.json is updated with version numbers, if not verify from npmjs and update manually
Delete app from the device and try to run again
But I cannot discern what the advisor is doing here... and the logic behind it... if it seems relevant, can someone comment on this?
Terminal Output
I am getting this in the terminal:
Loading dependency graph, done.
error: bundling: Error
at DependencyGraph._getAbsolutePath
(/Users/neo/newProjects/F2/node_modules/react-native/packager/src/node-haste/index.js:272:11)
at DependencyGraph.getDependencies (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/node-haste/index.js:216:26)
at Resolver.getDependencies (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/Resolver/index.js:106:27)
at _resolverPromise.then.resolver (/Users/neo/newProjects/F2/node_modules/react-native/packager/src/Bundler/index.js:561:62)
at process._tickCallback (internal/process/next_tick.js:109:7)
Bundling `index.ios.js` 0.0% (0/1), failed.
Versions
Node v7.9.0
react-native-cli: 2.0.1
react-native: 0.44.0
Homebrew 1.2.0
Just updated xcode
OSX 10.11.6 (15G1004)
What I notice
I notice that it seems to be looking in this file.. ["/Users/neo/newProjects/F2"] whereas in some locations on my machine the files are organized Users/Neo/... ( capital username ) ... and I sense that has something to do with this.
also, on project build it does throw this warning... not sure what it means...
"react-native#0.44.0" has unmet peer dependency "react#16.0.0-alpha.6"
Any suggestions or ideas?
update
tried changing directories out of the users folder and initializing
here is what I got in the stacktrace
2017-05-02 09:25:21.478 xcodebuild[52491:5334564] Error saving log: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSFilePath=/code/F4/ios/build/Logs/Build/B9E13558-CCE5-4451-AC21-7E643189BF7B.xcactivitylog, NSLocalizedDescription=No such file or directory} | User info: {
NSFilePath = "/code/F4/ios/build/Logs/Build/B9E13558-CCE5-4451-AC21-7E643189BF7B.xcactivitylog";
NSLocalizedDescription = "No such file or directory";
}
Installing build/Build/Products/Debug-iphonesimulator/F4.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/F4.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Also, tried installing expo and running from there...
Heres what the terminal shows
Error sourcing shell startup scripts: /Users/neo/.bash_profile: line 2: rbenv: command not found
/Users/neo/.bash_profile: line 4: rbenv: command not found
/Users/neo/.bash_profile: line 5: rbenv: command not found
/Users/neo/.bash_profile: line 7: rbenv: command not found
/Users/neo/.bash_profile: line 9: rbenv: command not found
/bin/bash: shell_session_update: command not found
.
Please run npm install -g exp && exp path``
10:25:22 AM
Starting React Native packager...
10:25:31 AM
Scanning 656 folders for symlinks in /code/my-new-project/node_modules (11ms)
10:25:32 AM
Loading dependency graph.
10:25:32 AM
Running packager on port 19001.
10:25:32 AM
10:25:37 AM
Dependency graph loaded.
10:25:51 AM
Project opened! You can now use the "Send Link" or "Device" buttons to view your project.
10:36:58 AM
Couldn't start project on Android: could not install *smartsocket* listener: Address already in use
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
`

cordova android build failure: processArmv7DebugResources

I'm building a hybrid app with cordova. The setup has been tested with simple application. Both android and iOS build works fine.
After switching to a more complex application, the following error occurred. I googled and found some suggested solution but none of the worked.
I'm new to this so any suggestion appreciated.
:processArmv7DebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processArmv7DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
* 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: 28.659 secs
ERROR building one of the platforms: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
In my case I discovered the error with the follow command:
cordova build android -- --gradleArg=--info
I have found:
Executing task ':processArmv7DebugResources' (up-to-date check took 0.009 secs) due to:
Input file /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz has been added.
Starting process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''. Working directory: /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android Command: /Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt package -f --no-crunch -I /Users/astaniscia/Library/Android/sdk/platforms/android-23/android.jar -M /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/manifests/full/armv7/debug/AndroidManifest.xml -S /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/merged/armv7/debug -A /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug -m -J /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/generated/source/r/armv7/debug -F /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_ --debug-mode --custom-package com.navionics.poc -0 apk --output-text-symbols /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/symbols/armv7/debug --no-version-vectors
Successfully started process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_'
:processArmv7DebugResources FAILED
:processArmv7DebugResources (Thread[Daemon worker Thread 16,5,main]) completed. Took 0.312 secs.
and this line helped me
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
for me solve the problem... I removed the gzip and now all work fine!
I had the same issue and this is what I found to be the issue.
The bower components folder - which normally defaults to www/lib/ using cordova - was the culprit in my case.
I had modified one of the bower components, to do that I had to first run npm install inside the specific package that I was updating. After doing that there was a node_modules folder inside the specific component I was updating i.e. www/lib/{name_of_component}/node_modules. Basically this specific node_modules folder is only used for build tools concerning the specific component, and thus it is not needed once you are done updating it and want to build the whole app. Some of the modules inside that specific component's node_modules may conflict with the projects node_modules i.e. {your_app}/node_modules - this can cause problems. In my case the conflict was with the semver module.
So in my case the solution was to delete that specific node_modules folder. After that I could build my app without any issues.
Hopefully this helps.
This is an old issue, but I recently came upon the same one and hope my experience might help someone else in the future.
After a solid day of looking around I realized it had to do with my plugins. For some reason there was an unused dependency in package.json that wouldn't allow it to build.
In my case, it was Firebase, and after removing it from package.json and the plugins folder I ran
cordova platform remove android
and
cordova platform add android
then built it again and all of a sudden it was up and running!
This error shows up because you have one or several accentuated filenames in your project folder. In my case, it was an image with the char "ç".
This topic can help rename automatically: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
For me it was the node_modules folder inside www that caused the problem.
The solution is to copy your www to another folder and exclude node_modules and you will be fine.
The thing that worked for me :
cordova plugin add cordova-android-support-gradle-release
Thanks to lohith95
from https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982/170
This is might because you use crosswalk,
You can try the following commands:
sudo ionic cordova platform remove android 
sudo rm -rf ./node_modules
sudo npm install --unsafe-perm=true --allow-root
sudo npm install --unsafe-perm node-sass
sudo ionic cordova platform add android#6.4.0 
sudo ionic cordova plugin add cordova-android-support-gradle-release
sudo ionic cordova build android 

Categories

Resources