Cordova error; Android Home windows, cmd - android

i´m trying to run my cordova application on my device, i already add the platform android to my project.
i´m doing all trought cmd.
but i got an error as you can see on the following picture.
Can you tell me what´s wrong? how can i fix it please?
i can run on browser with "cordova run browser", but it doesn´t work for android. it show me this error, and i can´t find a solution.

Can you tell me what´s wrong? how can i fix it please?
Cordova couldn't find Android SDK home in your computer. If you've already installed SDK, so make sure environmental variable ANDROID_HOME points exactly to the root of SDK directory.
i can run on browser with "cordova run browser",
No you can't run Android apps on browsers. You have two options:
Android emulator : run --emulator
Real Android devices connected via USB : run --device
More information:
https://cordova.apache.org/docs/en/4.0.0/guide/platforms/android/

for Windows 7 Computer -> (rightclick) properties -> Advanced System
setting. At Advanced tab you will see Environment variables (open it)
In the system properties window click the environment variables button.
Select the PATH variable from the System variables section. Select the Edit button. You need to add the path to your Android SDK platform-tools and tools directory. For Example: D:\adt-bundle-windows-x86_64-20130219\sdk\platform-tools;D:\adt-bundle-windows-x86_64-20130219\sdk\tools Save your Edit. Close the Environment Variable dialog.
Refer here :
See here for complete setup of environment

Related

React native failed to launch emulator

While trying to test the android app am creating with React native, I run into this error
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
I have the emulator(the AMD version) installed in the android studio.
How can I solve this problem
In your scenario before running react native application you need to create emulator using Android Studio. You can view official documentation about running application on device by here
Before running your project make sure you have installed adb drivers - More
First of all create AVD using Android Studio.
Open your project android folder using Android Studio.
1. Click AVD Manager from Android Studio
2. Click Create Virtual Device
3. Select your device from device list and click Next
4. Select the android os version from the available version list and click Next
5. On last keep default settings on device and click Finish
After that you can see your available android emulator device list from AVD Manager window.
* Before run your react native application make sure you have turn on and run the android emulator from android studio
After that run your project using react-native run-android
You can run the command adb devices to check if there is any device attached. It should list atleast one device for it to work
This also may be there is not enough space to run avd, make sure enoug space in hard disk. in my case freed atlest 9gb.
My answer is, If you have changed the directory of avds, you should set ANDROID_SDK_HOME environment variable to the parent directory of .android.
Here is the detail:
It seems like when you run "emulator -list-avds" in cmd, the result is empty. (be sure to first add "ANDROID_HOME" with value of your sdk directory to your user environment variable, and "%ANDROID_HOME%\emulator" in the Path too.)
After checking the official documents:
https://developer.android.com/studio/run/emulator-commandline#starting
It said:
"$ emulator -list-avds
When you use this option, it displays a list of AVD names from your Android home directory. Note that you can override the default home directory by setting the ANDROID_SDK_HOME environment variable: the root of the user-specific directory where all configuration and AVD content is stored. You could set the environment variable in the terminal window before launching a virtual device, or you could set it through your user settings in the operating system."
and in another page:
https://developer.android.com/studio/command-line/variables#envar
it said:
"Some older tools, such as Android Studio 4.3 and below, do not read ANDROID_USER_HOME. To override the user preferences location for those older tools set ANDROID_SDK_HOME to the parent directory you would like the .android directory to be created under."
So I guess the reason is "npx react-native run-android" will invoke "emulator -list-avds" to find the emulator. And "emulator" is really an older tools, so ANDROID_SDK_HOME environment variable is necessay.
And if all goes well, you really don't need to run android studio before run "npx reactive-native run-android".

flutter terminal is not working in android studio

i want to make apk of my flutter app. So I need to write "flutter build apk" command in terminal. but my terminal is not running any command. I am using Android Studio on Windows.
Yes, this issue is probably because the environment path variable is not set in your android studio. Yes, you will have to set it manually in the terminal settings.
In you Android studio:
1. Go to Settings
2. click on tools
3. Click on terminal
4.Now if your environment variable block is empty, click on right most part of the bar and copy paste the path(...\flutter\bin) and save it.
5. Now, restart your IDE.
6. Open terminal in Android studio and enter flutter run..
it will surely work
I have another solution which might work. I struggled myself until i saw a solution in a tutorial video.
Search for "env" in the Windows 10 search box, select "edit environment variables for your account".
Find or create the variable "Path" under "User variables for [USERNAME]"
Add a new entry to your flutter/bin directory and restart android studio. Run the doctor, or another command, to check if it works :-)
Should work now in (almost) every terminal besides!

How to open AVD manager in Android Studio 3.0 version?

after I update Android Studio from 2.3 to 3.0 version. I can not find AVD Manager in Tools/Android/AVD Manager.
I just did a fresh install and had the same issue. Solved by:
Click "Install missing platforms(s)..." in the highlighted error:
Then after the download/install, click "Intall Build Tools...":
Then after the download/install, you will see Android under Tools menu
If you have never used Android Studio Before, and do not have a Project
..Opening the AVD Manager is even trickier!!
For example, if you are installing it to use an emulator for a create-react-native-app project., but aren't otherwise using Android Studio to write or manage your app.
Here is how you can gain access to the AVD Manager.
AVD Manager is required to set-up your emulators.
Android Studio Documentation does NOT tell you how to gain access to AVD Manager. It starts at Open the AVD Manager!
I Just Need the emulator (and manager).
But I did not even have the window the OP refers to.
Nothing in the Configure menu, not Preferences (even Preferences -> Tools) gave me access to AVD Manager.
So in my case it was even more confusing to have No Direct Access AVD Manager !
Nor did I have an android folder in my create-react-native-app app, so hamdi's answer above did not work for me.
All I had was a new folder/git repo from:
create-react-native-app
My Solution
On the Android Studio Startup Screen, I choose:
Import Android Code Sample
Then choose any sample. (I choose the first example listed).
Then (after a bunch of downloading/building..), then brought up the window the OP refers to.
I then had to update gradle, as mentioned by user1449542's post above.
At that point, Muhammad Hannan's answer above was helpful !!!
I clicked the icon from the bottom image in his post -- vioa!
( Alternatively from the menu bar choose: Tools -> AVD Manager )
Better Solution:
I have since realized that the Startup Screen Option:
Start a new Android Studio Project
also works and is even quicker (less to download/build), and might not even need gradle file updates (mentioned by another post) that I had to do when I downloaded a sample project.
Just use the default settings to create a dummy project in the default location, and choose
Add No Activity.
Android Studio will "build" this dummy project, and set it up, then open the Window you need to access said icon, and/or menu bar.
In the future, this dummy project will appear on the left of Android Studio's Startup Screen.
Just click on that dummy project to re-open the window you need to access AVD Manager.
Then, as before, click that icon (or from the menu bar choose: Tools -> AVD Manager) to create/edit AVD emulators.
If you're using React Native (create react native app), you can start an emulator from the command line, once you have created an AVD emulator, and probably won't need to open Android Studio itself. (see notes below).
Be sure to start the emulator before choosing a (from the terminal window that's running your app via yarn start).
Additional Notes for reference:
To start the emulator from the command line:
emulator -avd <avd_emulator_name>
To list what emulators have been configured:
emulator -list-avds
AVD_Nexus_6P_API_23
AVD_Pixel_2_XL_API_27
AVD_Pixel_XL_API_25
So, for example, I can do this:
emulator -avd AVD_Pixel_2_XL_API_27
Additional Information
I also had to add the following lines to my .bash_profile
export JAVA_HOME=`/usr/libexec/java_home -v 10`
Note: the value between the back-ticks is what the JAVA install from my terminal replied. If you type that part into terminal by itself, it spits out the location Java was installed. If you have an different version of Java installed, just replace 10 with your version.
I then got the following path from:
- Android Studio Startup Screen -> Configure -> SDK ManagerPreferences
- Appearance & Behavior -> System Settings -> Android SDK
- Android SDK Location: /Users/sherylhohman/Library/Android/sdk
and used it as the value for adding the following line
export ANDROID_HOME=/Users/sherylhohman/Library/Android/sdk
Though I chose to write it as the following instead:
export ANDROID_HOME=$HOME/Library/Android/sdk
Finally I added:
PATH=$PATH:$ANDROID_HOME/emulator
PATH=$PATH:$ANDROID_HOME/tools
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/tools/bin
PATH=$PATH:$ANDROID_HOME/platform-tools/adb
export PATH
I may not have needed the ...adb or 1 or more of the last PATH entries.
This was a cumulation of many internet searches, many conflicting solutions. The major missing key was accessing AVD Manager (OP's question), which finally solved the problem. This just happens to be the items I had already added to my .batch_profile along the way trying to get the android emulator working inside my create-react-native-app App!.
I found this just under the toolbar in Android Studio (v3.2):
Go to the "Event Log" tab in the bottom right corner.
There will probably be some error messages. It will provide information and links to resolve the problem. Then the buttons will not be greyed out anymore.
I'm using Android Studio 3.0 on Ubuntu I have AVD under Tools > Android > AVD . And also on the right upper corner of the screen.
EDIT :
Go to Settings and search for AVD.
If you encountered the problem when using React Native, you are probably trying to include the whole project in Android Studio. You only have to include the android folder from the React Native project. After this process, Gradle will be synchronized and AVD Manager will come back.
I had the same problem.
If you get this message: "Frameworks detected: Android framework is detected in the project" then click on it and add Android.
After that, the icons should be enabled now.
you can find SDK manager,AVD manager TOP right side on android studio version more than 3.2.0.
and if you want to run via commmand promat you can go to
cd Library/Android/sdk/tools/bin
./avdmanager list
I had the same issue in Windows 10 and saw this solution in another post ... It worked for me.
Set-up the System Environmental Variables ANDROID_HOME and ANDROID_SDK_ROOT
To do this ...
Click the windows key and start typing System.
Select it when it pops up in the menu.
Click advanced system settings
Select the advanced tab
Click Environmental Variables at the bottom
Under system variables, click new
Enter the variable name
For value, enter the the path to the Android SDK, which will most likely be: C:\Users[username]\AppData\Local\Android\Sdk
Use the same path for both variables
In Andriod Studio 3.5 its here
Following the event log to install resolves the issue
Hit ctrl+shift+a and search avd and click on it
I was not able to find AVD manager in android studio easily for Android studio version 3.1.2.In order to launch AVD manager, i had to create a sample project and then launch it from there.
I have documented all my steps here, in case any one wants to get benifitted.
How to launch AVD manager on Android Studio 3.1.2

Android studio isn't opening on Windows

I just downloaded and installed Android Studio. For whatever reason, it won't open. I've tried running it as administrator, but that doesn't seem to work either. I've also tried uninstalling and reinstalling, but I'm still having this same problem.
On windows open task manager and check if android studio is there.
End the task and start the app again it works like a charm
Figured it out! I'm sure someone will run into this in the future, so here goes.
Even though it found my JDK during installation, it wasn't able to find it when I was trying to open it, for some reason. Simple fix. Add a JDK_HOME environment variable to your system variables. It should contain the path to your JDK's ROOT directory. i.e. c:\Program Files\Java\jdk1.7.0_21\
For me this technique works
Hover on icon, then hover on app
Press right click and select maximize
This link http://tools.android.com/knownissues lists another cause for the launcher malfunctioning.
I quote the link here:
"
On some systems the launcher script does not find where Java is installed. Workaround is to set a variable indicating the location of Java [b/55281]:
Open Start menu > computer > System Properties > Advanced System Properties
In the Advanced tab > Environment Variables, add new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21.
Another issue we found is that the launcher script uses an option that is unknown to Java on some system [b/55267]
Open the installation folder of Android Studio (e.g. C:\Programs Files\Android\android-studio, or C:\Users\\AppData\Local\Android\android-studio) and find the "bin" directory in there.
Open a "cmd.exe" (command prompt), cd to the android-studio\bin folder and run "studio.bat". You will most likely see an error: for example b/55267 is about the option -XX:+UseCodeCacheFlushing not being recognized. Report the error, remove the line from the studio.exe.vmoptions or studio64.exe.vmoptions and it should now work.
Apologies for this weak launcher."
OS: Windows 10 64bit
Need to delete below folder and try launch Android Studio again.
C:\Users\your_user_name\AppData\Roaming\Google\AndroidStudio4.1
Source: developer android
I am Installing Android Studio 4.1.1 in my Windows 10 and trying to open as normal as well run as administration both ways but did not open as regular.
When I saw in Task Manager then it was run as a background process then simply I was Endtask it in that background process and re-open. It works for me...!!!
Just add a JDK_HOME variable with the path of your JDK as value and start the IDE again. That's the only thing to do, hope this closes the other questions.
Windows 7 user:
I tried all the above ideas ( adding JDK_HOME, JAVA_HOME environment variables), but the final trick was to run as admin.
If that fails, try "where java" in cmd.exe.
If it lists c:\system32\java.exe first, then rename the file.
(i) Open the folder where android-studio is installed. (C:\Program Files (x86)\Android\android-studio)
(ii)- Right click on the android-studio folder and scroll to properties.
(iii)While in Properties window, click on Security.
(iv)Click the Edit Button
(v) Select User/Admin...or others
(vi)Check "Allow" in front of "Full control"
(vii) Either Apply or Press OK
....At this point you have to wait for it to install....Enjoy!!!
And I use Window 8...!!! So same thing applies to Window 7...wonder why the security on it...
I am on Windows 8 64 bit machine.
I already had JDK installed and jdk.1.7.0 folder was present in C:\Program Files\Java. But path for that folder didn't work. You must have jdk.1.7.xxx folder present on your machine and give that folder as JDK_HOME in Environment variable.
You can take latest JDK version from here
Make sure to choose Windows x64 version. Install JDK and then set your path. For those who are not sure how to set path in Windows 8, I have got following screenshots.
Go to bottom right corner. Click on Settings. Click on PC Info.
Click on Advanced System Setting link on left side.
Click on Environment Variables button. A Winodw will open with 2 listboxes. Click on New button below System variables listbox. New Window will pop up. Provide name as JDK_HOME and path as your path like "C:\Program Files\Java\jdk1.7.0_55". No need to take bin folder into the path.
None of the above mentioned solution worked for me. And there is no studio.bat file in bin directory.
So, I downloaded a 32-bit android-studio for my system (as it is 32bit) from here (official website) and it worked!
PS: The link might be broken in the future, just google for the 32 bit android studio.
(After wasting half a day on it, finally, I got it running)
I am running it on Windows 8.1. Also, I had JDK 1.7.0_13.
I tried the following:
Open Start menu > Computer > System Properties > Advanced System Properties In the Advanced tab > Environment Variables
Add new system variable JAVA_HOME that points to JDK folder, C:\Program Files\Java\jdk1.7.0_13\
Just to be on the safer side, also add new system variable JDK_HOME that points to JDK folder, for example, C:\Program Files\Java\jdk1.7.0_13\
Append new PATH in system variable that points to JDK folder, C:\Program Files\Java\jdk1.7.0_13\
But still it didn't work. Then it struck me that might be, my Java version is old. I downloaded the latest version from here.
I uninstalled JDK 1.7.0_13 and installed version 8 i.e. JDK 1.8.0_131.
Now do all the above steps but, replace the path with C:\Program Files\Java\jdk1.8.0_131\ OR whichever your latest version is.
Success!! Now it works.
In my case, I have existing projects and during trying the opening Android Studio, it just showed me the name of the project.
The thing I did was changing the name of that project and forcing Android Studio to ask me to choose which project at the beginning.
In my case, it was a windows related bug. Android Studio was configured properly and working like a charm, but it was opening in the second disconnected windows.
My solution was to press [Win] + Tab and then choose Android Studio on half of the screen so that it readjusts. Finally, I maximized it and it opened it in the correct screen.
I was able to resolve the same issue by refer to the solution provided in Android Developer Portal,
Studio doesn't start after upgrade
If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin. As a workaround, try deleting (or renaming, for backup purposes) the directory below, depending on the Android Studio version and operating system, and start Android Studio again. This will reset Android Studio to its default state, with all third-party plugins removed.
For Android Studio 4.1 and later:
Windows: %APPDATA%\Google\AndroidStudio Example: C:\Users\your_user_name\AppData\Roaming\Google\AndroidStudio4.1
macOS: ~/Library/Application Support/Google/AndroidStudio Example: ~/Library/Application Support/Google/AndroidStudio4.1
Linux: ~/.config/Google/AndroidStudio and ~/.local/share/Google/AndroidStudio Example: ~/.config/Google/AndroidStudio4.1 and ~/.local/share/Google/AndroidStudio4.1
In my case executing these in the command line worked after ending the Android Studio process in the task manager:
net stop winnat
net start winnat
Check the log file in :
C:\Users\<yourid>\.AndroidStudio<version>\system\log\idea.log
It might give you some clue.
You don't have to reinstall the Android Studio. In my case, I just deleted "C:\Users\User.AndroidStudio3.5" folder. Then Android Studio is opened. The folder contains just personel settings such as your ide theme darcula etc.
I invalidated cache and restartI deleted the Android studio version folder which was C:\Users\User.AndroidStudio3.5 for me and it worked like charm.
What worked for me was simply rebooting the computer. I'm certain that logging off and logging in will work to so the environment variables can refresh on profile level after installation.
Change the JAVA_HOME system environment variable to C:\Program Files\Android\Android Studio\jre
The direct path to installed java may not work sometimes due to version conflict.
I had Android studio crash on my machine crying about ram. Then it just wouldn't start again. Restarting th ecomputer wouldn't help and I know it has nothing to do with Java.
What ended up fixing it was runing Android Studio trough the Start Menu, or the instalation folder and not the pinned icon ...
Make sure you are not using two Languages (Hindi + English) as input method because android studio install required some time stamp and suppose you are using Hindi language that time and letters will not match at the time of opening
Solution is - select primary Language as English while installing Android Studio.
To change steps
press Windows
search word language
remove Hindi Language
then install Android Studio
I edited studio.bat file.
I added actual jdk placement to SET JDK= line at the beginning of file:
SET JDK=C:\\\Program Files\\\Java\\\jdk1.8.0_151
You must upgrade to 4.0.1 version!
The same problem happened with me. Actually my C drive wasn't full still I wanted to install android studio in D drive. The problem was resolved when I deleted it and again installed android studio.
Install it in C drive (You don't have to do anything for that. Actually, just click next...next.. next.. while installing and you are done.
)
Zuhair Naqi's solution is good, but in my case I don't have the option to maximize. So I found another method, because in my case the Android Studio (Bumblebee) does not open every time the windows was updated.
Select right click on the android studio icon, and open some recent project.
A new window will open with the recent project correctly.
You close the window that you couldn't see, and from there you can open projects normally.
I was able to solve it by going to control panel and uninstalling android studio, then restarting the computer so that any running instances would close. Next I deleted the folder
C:\Program Files\Android\Android Studio
Re-installed everything, and everything was working fine.

Titanium Studio cannot find Android SDK (tried multiple solutions)

Okay. I'm kind of at my wits' end here. I've been trying for about 2 days to set up Titanium Studio to recognize and connect to the Android SDK (Windows 7). I have tried multiple solutions (below) with no luck. There's got to be something I'm missing. I've tried Google and the Titanium developer guides. So this is my last straw. Any ideas?
Android SDK home path is C:\Android\android-sdk (to avoid spaces with "Program Files")
installed all SDKs (3,4,7,8,10,11,12,13,14,15), their Samples, and all Google APIs
installed all "Extras" packages
Added both the Android tools and platform-tools directories to Windows' PATH variable
Copied adb.exe from platform-tools to tools as Titanium likes to look there for adb
Installed the current master build of Titanium SDK for Mobile Devices
Created Android Virtual Devices (AVDs) for SDKs 7 and 8 (Titanium's required SDKs)
Restarted adb server and computer itself after each change
On the Titanium 'Dashboard' tab, under 'Configure', I get:
An Android SDK is missing. Titanium requires Android platforms 2.1.* and 2.2.*
When attempting to set the default Android SDK path in 'Preferences', I get:
Could not locate the Android SDK at the given path
Titanium log file output (sorry, kinda long):
!ENTRY com.appcelerator.titanium.mobile 4 0 2012-02-22 14:06:21.992
!MESSAGE (Build 1.0.0.1327639206) [ERROR] [ERROR] The system cannot find the path specified.
[ERROR] The system cannot find the path specified.
Traceback (most recent call last):
File "C:\Users\Stick\AppData\Roaming\Titanium\mobilesdk\win32\2.0.0.v20120221190136\android\avd.py", line 45, in <module>
print get_avds(sdk)
File "C:\Users\Stick\AppData\Roaming\Titanium\mobilesdk\win32\2.0.0.v20120221190136\android\avd.py", line 21, in get_avds
for line in run.run([sdk.get_android(),'list','target'],debug=False).split("\n"):
AttributeError: 'NoneType' object has no attribute 'split'
I have no idea what's missing. Eclipse recognizes everything just fine. ANY suggestions??
P.S.
I've noticed that when I attempt to run 'android' commands, i.e.
android
android list targets
I get what seems to be an error:
The system cannot find the path specified.
However, the commands still continue to run with no issues (I get a list of all the targets and the SDK Manager pops up). I'm not sure whether or not whatever is causing that message is also causing Titanium headaches.
I was facing the exact same issue, but now I have figured this out and it was working fine.
Basically, when I install Titanium Studio and I configure Android SDK it worked fine, but when I try to execute Project there was "javac not found" error. While resolving this issue I came across a Post where it was mentioned to include '%JAVA_HOME;%' in your Path. And when I did this the Android SDK was not longer detected by Titanium.
I removed the '%JAVA_HOME%' from Path Variable and then I include Java bin Folder Path to Path Variable and created a new variable 'JAVA_HOME' which points to root directory of Java installation. Everything works fine after doing this step.
I hope you will now get your Titanium Environment running. :-)
Thanks.
Newer version of Titanium have the Update Android SDK option in the Dashboard. Just make sure, the path is correct. Some cases like mine, there might be two Android SDK paths; one was obsolete and the other was active. So, please make sure of that path. When Titatnium is about to update the SDK software, looking in for newer versions, please select Cancel, as that wouldn't be required!
open titanium ide.
click on file-> titanium mobile project.
a window will show up with a link Set-up/Configure SDKs in the
bottom. click on this link.
now give android sdk home: c:\Androi\android-sdk (or browse to
android-sdk folder in your system)
select the default Android Sdk
click Apply
Click Ok.
You should be good to go.
Let me know if you face any problems.

Categories

Resources