Not able to setup React native project on windows - android

Hi I have followed the official documentation for setting up the React native project on windows.
I have added the ANDROID_HOME variable as system variable at location
"C:\Users\AKSHAY\AppData\Local\Android\Sdk"
In the second step I was supposed to add Environment variable at
"C:\Android\tools\bin\platform-tools"
but there is no tools folder in Android instead I found platform-tools under SDK below is the location
"C:\Users\AKSHAY\AppData\Local\Android\Sdk\platform-tools"
Now when I am running
npx react-native run android
I am getting the below attached error
Here is the SDK folder
Please help.

setup an android emulator first with avd

if your RN >=.62
You can run npx react-native doctor inside your project folder
else
run npx #react-native-community/cli doctor inside your project folder
This command checks your environment and displays a report of the status of react native installation. Check the output carefully for other software you might need to install.

You can install android studio then add ANDROID_HOME to your ENV Variable and point to your SDK.
Follow this link: https://web.archive.org/web/20180210044548/http://spring.io/guides/gs/android/

The path you are looking for is located at :
C:\Users\"yourUser"\AppData\Local\Android\Sdk\platform-tools

Related

Path in .bash_profile give error: "-bash: flutter: command not found"

I am following Flutter official documentation for adding flutter Path in .bash_profile in order to run commands on terminal but it give me error
-bash: flutter: command not found
Is there any quick way to add Flutter support in android studio for was Android Developers. I am trying to find the easy way to add Flutter support on running Android environment.
My .bash_profile contains the following line:
export PATH="$PATH:$HOME/Developer/flutter/bin"
I have tried all my possible answers but no luck.
P.S I'm using bash not zsh any other.
I have faced the same issue. I assume that you've downloaded the flutter SDK from official docs as I did and tried so many solutions.
I resolved this issue with the following steps:
download the Android Studio
Open Android studio's preferences -> Plugins -> download flutter plugin
File -> New -> Create New Flutter project
In the next dialogue under the "Flutter SDK path" you can see install SDK... option (install the SDK from there at your desired location)
Once SDK is installed then update your .bash_profile with the newly downloaded SDK.
Your .bash_profile should look something like this:
export PATH="$PATH:$HOME/Developer/flutter/bin"

How to fix 'Android SDK not found at this location' error while installing flutter?

I'm installing flutter in my Ubuntu 18.10. I'll be using Visual Studio Code for flutter development. I've not installed Android Studio.
I've downloaded Android Command line tools from official android site and extracted it in a separate folder in Documents/development/android
I set the path for ANDROID_HOME in the bashrc file by following the flutter documentation
Here is the .bashrc file
And the Android toolchain error
It seems that , you set the ANDROID_HOME variable but it is not added to PATH.
Make sure you add the ANDROID_HOME to the path as below
export PATH=$PATH:$ANDROID_HOME/bin
and re-launch the console.
update
In order for Android SDK to work fine, you need to set path for the below SDK packages.
..android-sdk\tools
..android-sdk\platform-tools
and your ANDROID_HOME will be
..android-sdk
I am not sure what you are referring to when you are saying that you have downloaded Android Command Line tools. From the output in your terminal, it tells me that you do not have the SDK files in your machine. To download the Android SDK, please see this link here and download the tar file that matches your operating system. Then extract the tar file in the folder which you have set as ANDROID_HOME. This should work fine.
In case you are having the same error, I strongly recommend downloading the Android Studio and install the Android SDK through the Android Studio. The flutter documentation says so as well. You can always uninstall or remove Android Studio after it is being installed and if you are not considering using it.
please replace yout android sdk in thatway this is default installation location of sdk C:\Users\Intel\AppData\Local\android\android_sdk

Unable to locate the Android SDK

I already had Android Studio and the Android SDK installed. I later added Flutter and the Flutter SDK. Here is my problem: When I run
flutter doctor
It shows,
that I do not have the Android SDK installed.
You can configure the Android SDK for your project using
flutter config --android-sdk /path/to/android/sdk
The PATH variable also should contain the SDK, like
export PATH=$PATH:/usr/local/opt/android-sdk/emulator:/usr/local/opt/android-sdk/build-tools/26.0.1:/usr/local/opt/android-sdk/platform-tools:/usr/local/opt/android-sdk/tools
/usr/local/opt/android-sdk and 26.0.1 might not match your system. That's just an example.
Step-by-step guidance for Windows with pictures
Step 1.
If you see this error, it means Flutter does not locate your Android SDK.
There are two folders containing all files of the "Android SDK". They are "Platform" and "Platform Tools":
Those folders are located in my computer here:
C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk
(My name is Zohaib Saleem, and you should replace my username folder name with your computer username.)
Step 2
Type "Env" in the search bar of Windows
Click on "System Variable Environment"
Click on "Advanced and Environment Variable"
Go to System Variable → Path → Edit:
Now paste the path of both folder "platform" and "platform-tools", respectively.
In my case, the paths are:
C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk\platforms
C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk\platform-tools
After adding the path to your System variable it looks like:
Click OK
Restart PowerShell and again run the command "flutter doctor".
Now, the Android SDK problem is resolved, but you faced another problem:
To resolve this issue, just run the command
flutter doctor --android-licenses
And accept all with "Y". At the end, after typing multiple 'Y's, again run 'flutter doctor' and all is set!
flutter config --android-sdk /your path
example
flutter config --android-sdk /root/Android/Sdk
Tools > SDK Manager > Android SDK
images
Locate the Android SDK folder (e.g., D:\SDK).
Add platforms (D:\SDK\platforms) and platform-tools (D:\SDK\platform-tools) to the PATH variable.
Run flutter doctor. It should not show any errors or warnings.
For this issue you have to add three variables to the Path in the:
C:\Users\admin\AppData\Local\Android\platforms // The path to
platform
C:\Users\admin\AppData\Local\Android\platform-tools //
The path to platform-tool
C:\Users\Admin\AppData\Local\Android\emulator // The path to
emulator

cordova: Error: Android SDK not found

I want to run ionic code with Genymotion as emulator. I ma using windows 10. My C drive is run out of space and I installed everything in D drive.
However, when I run ionic run android, I get the Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Firstly, I have the sdk directly at D:\sdk-tools-windows-3859397\platform-tools as the picture below:
The environment variables is set as below:
When run adb at the path, it can run successfully
I also set the SDk with both default and customs ANdroid SDk tools, but both return same error
What else that I missed out that give the error?
UPDATES:
as Djinggy suggest,environment variables set to a level up and path set for platform-tools and tools, however, the same error still there with ionic run android
open terminal in your ionic project:
In windows use these commands :
set ANDROID_HOME=C:\ installation location \android-sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
In linux use these commands :
export ANDROID_HOME=/installation location/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
On Windows, you have to set your ANDROID_HOME path to root sdk path (D:\sdk-tools-windows-3859397\) and adding to you PATH variable :
%ANDROID_HOME%\tools
%ANDROID_HOME%\platform_tools
The SDK root/home should be one level up from "platform-tools" not "platform-tools".

Cannot detect SDK path in WebStorm 2016.3

I am trying to create a PhoneGap application using WebStorm 2016.3 IDE.
I am following this link link. I am able to create a project from the steps but while running the app I'm getting errors. While setting emulator I've found that Android SDK was not found.
I am unable to find how can I set that path here and the error I got is:
...and in log cat
"C:\Program Files (x86)\JetBrains\WebStorm 2016.3\bin\runnerw.exe" "C:\Users\Sa E\AppData\Roaming\npm\ionic.cmd" run --emulator android
✗ You cannot run iOS unless you are on Mac OSX.
I've tried some things by google but the data is for old IDE and I can't see such options with my current IDE.
I ran into the same issues on Windows. I added a system variable ANDROID_HOME with the address of the sdk folder. In my case it was
c:\Users\Andrew\AppData\Local\Android\sdk
After that, I restarted WebStorm, and it works fine.
PS make sure that you set up the project properly. Try creating a new project with type "PhoneGap/Cordova", then in the terminal type the following commands:
ionic start MyProjectName
ionic serve
If everything works at this point, then proceed:
ionic platform add android
ionic build android
ionic emulate android
You can use run instead of emulate if you have GenyMotion installed and running
I used #Andrew's answer, but did not manage to make it work. It appears i needed more Environment variables; so, after many searches, I found this link on Cordova documentation which helped me in making PHPstorm recognize the Android SDK. The question was about Webstorm, but the Cordova plugin requires the same environment variables.
Here's a quote from that site (if you do not know how to set environment variables, follow the above link to get help):
Cordova's CLI tools require some environment variables to be set in order to function correctly. The CLI will attempt to set these variables for you, but in certain cases you may need to set them manually. The following variables should be updated:
Set the JAVA_HOME environment variable to the location of your JDK installation
Set the ANDROID_HOME environment variable to the location of your Android SDK installation
It is also recommended that you add the Android SDK's tools, tools/bin, and platform-tools directories to your PATH
I faced the same problem with intellij idea ultimate on linux, while trying to run a cordova/phone gap project. Weirdly enough, the commands where running normally from the command prompt and the embedded terminal, however, trying to create a run configuration, I got the infamous errors.
I have the environment variables set correctly, but, I have them set in ~/.bashrc which intellijidea seems not t read.
I tried to add the variables manually in the same screenshot you included, with no success. The solution was to add ANDROID_HOME to the /etc/environment, rebooted, and everything worked as expected.

Categories

Resources