Issue
I recently started learning React-Native and was trying to run a project on Android emulator.However, this was succeeded at the first attempt, but now It doesn't, throwing the following error.
Execution failed for task ':app:installDebug'.
java.io.IOException: Cannot run program "C:\Users\Pavindu\AppData\Local\Android\Sdk\platform-tools\adb.exe": CreateProcess error=740, The requested operation requires elevation
Since this is a well known error message,I could find lot of answers regarding this error.The following were the actions I took according to those answers.But none of those helped me.
- Running both android studio and cmd as administrator
- Running
cmd /c react-native run-android
- Deleting
node_modules
andnpm install
Solution
After struggling a lot, here is what I did to overcome the problem.
- Copied
/Sdk
folder and pasted it in a different location while keeping the old SDK folder there. - Deleted
platform-tools
folder in copied SDK folder - downloaded
platform-tools
from android site and added it to new SDK folder. - set new SDK location to
ANDROID_HOME
(I use windows)
and android/build.properties
file in my react-native project.
sdk.dir="C:\\path\\to\\new\\sdk"
When I run react-native run-android
after these steps,all started working fine.
Note: I know that this seems hacky, but as a help for someone, I decided to write this .
Answered By - Pavindu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.