Related
I'm using Ubuntu 18.04
Android Studio Version 3.6.3
I think I have two installed Gradle locations If I'm not wrong
One of them installed using sdkman, when I use terminal to locate the Gradle
which gradle
Also, I've found (I don't remember if I installed Gradle in another way instead of sdkman) in my home directory, this is the one which Android Studio is using (I think) and make issues when opening a project
I think I need to use sdkman as it's easier to update the Gradle version etc.
So, my question is should I remove the gradle from: "/home/khaledomara/.gradle". If so, what is the best method to do that and what path should I put in the settings of Android studio?
Should it be "/home/khaledomara/.sdkman/candidates/gradle/current/bin/gradle"?
You only have one Gradle installed - the ~/.gradle directory is where a running Gradle process stores data and it can be safely deleted (assuming you don't have a gradle.properties or similar with any settings you want to save - but there is no need to delete it).
It is not a bad idea to do a gradle init in your Android Studio project - this will give your project its own Gradle that you can upgrade at your leisure without having to rely on the globally installed Gradle.
When I run the ionic capacitor run android command, to launch my application in Android Studio, I get the error saying:
Unable to launch Android Studio." You must configure "linuxAndroidStudioPath" in your capacitor.config.json to point to the location of studio.sh, using JavaScript-escaped paths:
example:
{
"linuxAndroidStudioPath": "/usr/local/android-studio/bin/studio.sh"
}
but I configured the path my capacitor.config.json but the error persists.
Here's my capacitor.config.json file
First, run whereis android-studio in your terminal. This command will return the path of your android studio.
Mine is /snap/android-studio/current/android-studio/bin/studio.sh. I installed android-studio from the ubuntu software store. Maybe you installed it through a different source and in a different location.
Then add "linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh" in capacitor.config.json which is located in the root of your project.
Replace /snap/android-studio/current/android-studio/bin/studio.sh by your path. which is returned to you by whereis android-studio
"linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh" is the path.
Add sudo when running the project sudo npx cap open android
in my case, android studio location was "/opt/android-studio/bin/studio.sh"
{
...
"linuxAndroidStudioPath": "/opt/android-studio/bin/studio.sh"
}
I use JetBrains Toolbox and macOS
to open the capacitor project with Android Studio with npx cap open android I had to export the Android Studio path as follow:
export CAPACITOR_ANDROID_STUDIO_PATH="/Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119/Android Studio.app"
Set environment variable--
Step1- Run: nano ~/.bashrc in terminal.
Step2- Add export CAPACITOR_ANDROID_STUDIO_PATH="path of android-studio/bin/studio.sh" in .bashrc file.
Step3- Run npx cap open android in terminal.
I have the same issue and I didn't manage to find out why it can't verify the path for android studio.
In order to use npx cap open android i had to open Android Studio before running the command.
Open your terminal and run gedit .bashrc.
Set the environment variable:
export CAPACITOR_ANDROID_STUDIO_PATH="path of android-studio/bin/studio.sh"
Save your file with Ctrl+s.
This will read your capacitor directly by running
Ionic cap open android
All of the answers here are on point, however I would like to add something small to note.
Its worth noting that Android Studio has different installation locations depending on the distribution you are using and also some installations are command-line based others are offline installations.
Some well known places are:
/usr/local
/usr/share
/opt
Lastly whereas the commands to search for android-studio may work in some instances where the default installation path was not changed. However the command
whereis android-studio
will not return anything in a case where the directory name is not the default i.e
/opt/android-studio-2021.2.1/android-studio/bin/studio.sh"
or
/usr/local/android-studio-2021.2.1/bin/studio.sh"
Here's how I solved this: In Ionic 6x, there's no capacitor.config.json. You'd have to set an environment variable of CAPACITOR_ANDROID_STUDIO_PATH globally. Do this by typing
export CAPACITOR_ANDROID_STUDIO_PATH=/path/to/android-studio/studio.sh
Worth noting that my Android Studio is found at /opt/android-studio/bin and not under /snap/...
Everything looks correct so the likely answer is that you have got the path wrong somehow.
Could you recheck it?
Also, are you running the latest versions of everything?
Anybody knows how to get around this issue while launching Android Studio?
I saw a Google ticket here, but it was not useful: https://code.google.com/p/android/issues/detail?id=164202
Internal error. Please report to https://code.google.com/p/android/issues
java.lang.AssertionError: Unexpected node Pythonid; nodes=[org.jetbrains.plugins.terminal, org.jetbrains.plugins.javaFX, org.jetbrains.plugins.gradle, org.jetbrains.plugins.github, org.jetbrains.java.decompiler, org.jetbrains.idea.maven, org.jetbrains.android, org.intellij.intelliLang, org.intellij.groovy, org.editorconfig.editorconfigjetbrains, hg4idea, com.millennialmedia.intellibot, com.jivesoftware.robot.intellij.plugin, com.intellij.ui-designer-new, com.intellij.tasks, com.intellij.properties, com.intellij.modules.xml, com.intellij.modules.xdebugger, com.intellij.modules.vcs, com.intellij.modules.python, com.intellij.modules.platform, com.intellij.modules.lang, com.intellij.modules.json, com.intellij.modules.java, com.intellij.modules.androidstudio, com.intellij.modules.all, com.intellij.java-i18n, com.intellij.copyright, com.intellij, com.google.gct.testing, com.google.gct.login, com.google.gct, amailp.intellij.robot, TestNG-J, Subversion, JUnit, Git4Idea, Coverage, CVS]
at com.intellij.util.graph.GraphGenerator.buildOuts(GraphGenerator.java:55)
at com.intellij.util.graph.GraphGenerator.<init>(GraphGenerator.java:36)
at com.intellij.util.graph.GraphGenerator.create(GraphGenerator.java:40)
at com.intellij.ide.plugins.PluginManagerCore.createPluginIdGraph(PluginManagerCore.java:543)
at com.intellij.ide.plugins.PluginManagerCore.initializePlugins(PluginManagerCore.java:1126)
at com.intellij.ide.plugins.PluginManagerCore.initPlugins(PluginManagerCore.java:1256)
at com.intellij.openapi.application.impl.ApplicationImpl.loadApplicationComponents(ApplicationImpl.java:348)
at com.intellij.openapi.application.impl.ApplicationImpl.<init>(ApplicationImpl.java:215)
at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:45)
at com.intellij.idea.IdeaApplication.<init>(IdeaApplication.java:112)
at com.intellij.idea.MainImpl$1$1.run(MainImpl.java:47)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
It looks like you have a corrupted installation file - completely uninstall Android Studio and download it again from the website.
Install the newly downloaded version of Android Studio on your system - the one you had previously downloaded is likely corrupt.
Here are the instructions to uninstall Android Studio completely. Note that some files may be located in a different location depending on where you chose to install and the versions you've been using so if something is not in its normal place, please let me know.
Please follow all of the steps below in order.
Run the uninstaller
The first step is to run the uninstaller. Open Control Panel by accessing it from the menu when you right-click the Start Button (This applies for Windows 8 systems). Then, under Programs, select Uninstall a Program. After that, click on Android Studio and press Uninstall. If you have multiple versions, uninstall them as well.
After you have uninstalled Android Studio, it is recommended that you restart before proceeding with the steps below.
Remove the Android Studio files
To delete any remains of Android Studio setting files, in Windows Explorer (The file browser in Windows), type this as the File Path:
C:\Users[YOUR WINDOWS USERNAME]
Replacing [YOUR WINDOWS USERNAME] with the username of your account on Windows. If you don't know your username, navigate to C:\Users and it will list all users on the system.
Here, delete .android, .AndroidStudio and any versions of this directory with versions on the end, .gradle and .m2.
Then, go to
C:\Users\Harry[YOUR WINDOWS USERNAME]\Roaming
and delete the JetBrains directory.
Finally, go to
C:\Program Files
and delete the Android directory.
Remove the SDK
To delete any remains of the SDK, in Windows Explorer, type this in as the File Path:
C:\Users[YOUR WINDOWS USERNAME]\AppData\Local
Here, delete the Android directory.
(Optional) Delete all previous projects
If you want to delete any of your previous projects, the directory where your projects are found is the AndroidStudioProjects directory. It is located in your root user file, C:\Users[YOUR WINDOWS USERNAME].
Hopefully this will now have deleted the Android Studio files and you can now try reinstalling the tools.
If you have any problems doing so, give me a shout :)
1st step please disconnect your internet connection and restart the studio.
If it is not working??? Do the following steps.
Open the folder bin under the directory where you installed your Android Studio.
Find the file idea.properties and open it with Notepad++/UltraEdit/other_edit_tools.
Add disable.android.first.run=true as the final line and save the file.
Restart Android Studio.
Remove lib folder .local/share/Google/AndroidStudio4.1/marketplace
or execute command
rm -rf ~/.local/share/Google/AndroidStudio4.1/marketplace/lib
To recover from this state, you need to remove the "python" folder that you find here:
~./AndroidStudio1.2/config/plugins
(Found at https://code.google.com/p/android/issues/detail?id=164202, worked for me)
I have this problem in android studio in linux OS after install a plugin,i resolved this issue with deleted.AndroidStudio3.2 folder from Home Directory and other way you can go to this directory and delete the plugin that caused it .
Directory : /home/your system's name/.AndroidStudio3.2/config/plugins .
and for windows OS you must go to this Directory :
C:\Users\your system's name.AndroidStudioPreview3.2\config\plugins
Note : this directory is hidden and you must visible befor use it .
I did faced this issue too, where it says to do this in my windows 10:
please report to https://code.google.com/p/android/issues in a windows error message.
It happened when i added some plugins in Android studio in Windows.
It persisted in my machine until i opened my Android Studio as an administrator and then uninstalled the most recent Plugins from File > Settings > Plugins > Installed Plugins.
What went wrong may be I added many plugins and applied all of them at once. May be i should have added one plugin at a time. Like install a plugin > apply that plugin and restart my Android Studio IDE in order to see it's effects.
MacOS
My issue was with a plugin. I tried all sorts of ways of deleting Android folders using terminal. Nothing was working for me until I searched all instances of AndroidStudio in Finder and deleted each of them. After reinstalling everything worked great!
I solved it by removing an incompatile plugin located here: ~\AppData\Roaming\Google\AndroidStudio4.1\plugins.
I deleted the folder "marketplace"
Open the folder bin under the directory where you installed your Android Studio.
Find the file idea.properties and open it with Notepad++/UltraEdit/other_edit_tools.
Add disable.android.first.run=true as the final line and save the file.
Restart Android Studio.
It information helped for me
<<~ ~ ~ Quick Solution for Windows 10, Hope it will help ~ ~ ~>>
Download the latest Android Studio from the official website
Uninstall the existing Android Studio from your computer. NB: Remove Settings Preferences too while uninstalling.
Restart your computer
Install the newly downloaded Android Studio
Delete the old directories which will show when run the Android Studio the first time after installation of the new Android Studio.
NB: Do not remove your SDK files after uninstalling the Android Studio, if you want to save your time in installing the Android Studio.
I have solved this problem, depending on the system you use delete the following files:
Linux:
~/.local/share/Google/AndroidStudioPreview4.1
Windows:
C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudioPreview4.1
MacOS:
~/Library/Application Support/Google/AndroidStudioPreview4.1
Thanks #Jonilson Coelho dos Anjos
For Ubuntu users
go to home
press ctrl+h to show hidden folder .local
now go to .local folder
you will find share folder, go inside share folder
find Google folder and delete it
Open Android Studio
Enjoy !!
delete paid plugin in android studio plugin folder (C:\Users\your_computer_name\AppData\Roaming\Google\AndroidStudio4.1\plugins) and will work correctly. it works for me.
paid plugin should have to activate otherwise it will conflict.
1) Go to
'C:\Users\your-user-name\AppData\Roaming\Google\'
2) Delete folder
'AndroidStudio4.1'
3) Then restart Android studio.
I hope this works for you.
I came with a new solution. Instead of uninstalling Android Studio and removing all related folders and losing your programming state on Android studio, and beside all these wasting your time, you should try this solution first which worked for me:
In my case the problem was the Windows. As it has crashed recently, I figured out the problem could be it, so I decided to restore the windows to the most recent point before Android Studio crashed. But the system restore tool didn't allow me to restore my system at all, and it said I should repair missing or corrupted system files first.
I first used Microsoft System File Checker tool thread to fix the case, and guess what? after restarting the windows 10, all problems gone. No need for uninstalling the Android Studio or removing any plugins or even restoring the windows to an stable state.
Hope this work for you too.
error Android studio
Hi everyone, I have this problem recently and I found the solution by deleting plugins which was corrupted in:
~AppData\Roaming\Google\AndroidStudio2021.1\plugins
-EmmyLua
-Luanalysis
My solution is:
Delete folder C:\Users\[user]\AppData\Roaming\Google\AndroidStudio
Delete folder C:\Users\[user]\AppData\Local\Google\AndroidStudio
Run AndroidStudio.
Note:
Android Studio will be opened like fresh install.
100 % solved
1st go to
C:\Users\your-user-name\AppData\Roaming\Google\
2nd Delete folder
List item
'AndroidStudio4.1'
'AndroidStudio4.1-backup'
DELETE ALL ALL ANDROID STDIO VERSION AND BACKUP RELATED FOLDER
3rd Start again android studio
I'm trying to install PhoneGap and I'm getting the following error:
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error (screenshot)
What do I do to ensure Android is set up correctly for use with Cordova?
For Windows:
set ANDROID_HOME=C:\ *installation location* \android-sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Taken from this installation guide.
For Mac OS X:
export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
I have MAC OS X Yosemite, Android Studio 1.0.1, JDK 1.8, and Cordova 4.1.2
When I tried to add the android project:
cordova platforms add android
I received the message:
ANDROID_HOME is not set and "android" command not in your PATH
Based in cforcloud's answer...
'Error: the command "android" failed' using cordova
and
http://developer.android.com/sdk/installing/index.html?pkg=studio
I used the following:
export ANDROID_HOME="/Users/<user_name>/Library/Android/sdk"
export ANDROID_TOOLS="/Users/<user_name>/Library/Android/sdk/tools/"
export ANDROID_PLATFORM_TOOLS="/Users/<user_name>/Library/Android/sdk/platform-tools/"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
echo $PATH
When I tried to create the android project, I received this message:
Creating android project...
/Users/lg/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:126
throw e;
^
Error: Please install Android target "android-19".
I ran Android SDK Manager, and installed Android 4.4.2 (API 19) (everything but Glass Development Kit Preview). It worked for me.
===
This is the content of my .bash_profile file.
export PATH=$PATH:/usr/local/bin
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
launchctl setenv STUDIO_JDK /library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
export ANDROID_HOME="/Users/<UserName>/Library/Android/sdk"
export ANDROID_TOOLS="/Users/<UserName>/Library/Android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="/Users/<UserName>/Library/Android/sdk/platform-tools"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
To edit .bash_profile using Terminal, I use nano. It is easy to understand.
cd
nano .bash_profile
I hope it helps.
for windows:
Right click on My computer -> properties -> Advanced system setting -> Environment Variables
Edit Path on system variables to ;\yourSdkHome\tools;\yourSdkHome\platform-tools.
Then Close your cmd prompt and reopen.
On Linux, add this to the end of your .bashrc, .profile or appropriate file for your shell:
export ANDROID_HOME=/home/youruser/whatever/adt-bundle-linux-x86_64-20140702/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
Please notice that these environment variables will be available for newly created shells, not the already open.
Using Android Studio on Windows the system variables settings have changed a little.
You still have to add a system variable ANDROID_HOME, but pointing to the directory containing the android SDK usually installed in C:\Users\YOUR_USERNAME\AppData\Local\Android\android-studio\sdk.
You also need to add the following to the Path system variable:
;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
Taken from: https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows
SDK Path also be in C:\Users\USER\AppData\Local\Android\sdk
This is what I just tried to make it work. I was in:
os x Yosemite version 10.10.2
cordova version 4.2.0
android studio 1.0.1
Java SE Development Kit 7
set path:
# on ~/.zshrc file (open a text editor)
export ANDROID_HOME="/Users/<user>/Library/Android/sdk/"
export ANDROID_TOOLS="/Users/<user>/Library/Android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="/Users/<user>/Library/Android/sdk/platform-tools"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
reopen terminal
install "android-19" from android SDK manager
$ android
# pick "SDK Platform Android 4.4.2, API 19"
and then go to a Cordova-based project directory
$ ionic platform add android
Android path set in linux:
$export ANDROID_HOME=/usr/lib/android-sdk-linux
$export PATH=$PATH:$ANDROID_HOME/tools
$export PATH=$PATH:$ANDROID_HOME/platforms-tools
than
$cordova run android
In Linux,
edit .bashrc file and add the ANDROID_HOME and PATH variable,
export ANDROID_HOME=/usr/local/android-sdk-linux/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
After saving .bashrc file, run
source ~/.bashrc
then in type
android in a terminal
if it will run, ANDROID_HOME and PATH is set,
if you get this message,
bash: /src/android-sdk/tools/android: Permission denied
then run
sudo chmod a+x /usr/local/android-sdk-linux/tools/android
otherwise you will get same error message
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.
NB: Use your android sdk installation path instead of /usr/local/android-sdk-linux/
For Windows I just had to add an env variable pointing to the SDK folder. Done!
(The accepted answer didn´t work for me)
Only one change was needed to fix the problem:
Go to Start -> Control Panel -> System -> Advanced(tab) -> Environment Variables -> System Variables
set ANDROID_HOME to C:\Program Files (x86)\Android\android-sdk
ANDROID_HOME is deprecated now instead of using ANDROID_HOME use ANDROID_SDK_ROOT
as per Google android documentation -
ANDROID_SDK_ROOT sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_HOME, which also points to the SDK installation directory, is deprecated.
If you continue to use it, the following rules apply:
If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT.
If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.
For details follow this Android Documentation link
I had to close and re-open my windows console (or open a new console), and then open the SDK manager (ran android), after which a bunch of updates and installs had to complete.
For those who are working with Ionic Framework on windows and doesn't have andorid studio installed on their PCs, you must have either download Android Studio or at list download the SDK Manager.
If you choose the SDK Manager option you have to set the path for the Enviroment Variable:
Variable name: ANDROID_HOME, Variable value: the path where you installed the android SDK, in my case is, C:\Android\android-sdk.
You have to add the variable to the Path variable system by adding this:
;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;.
Then if you got the "JDK error" just download it from the Oracle website and create a system variable like the Android SDK:
Variable name: JAVA_HOME, Variable value: the path where you installed the JDK, in my case is, C:\Program Files\Java\jdk1.8.0_144. Then add it to the Path variable system by adding ;%JAVA_HOME%\bin.
Then if you got the "Gradle error" just fallow the installations steps on the official website of gradle.
Finally you can continue to creating your ionic app's apk.
Note: you have to reopen the cmd window several times or restart your pc after making those changes. Hope this work for you.
Using Android Studio on Mac, run this on your terminal:
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
Then, when you type
android
at your terminal, it will run something
You just need to type a command in flutter_console.bat type flutter config --android-sdk <path-to-your-android-sdk-path>
Go to system properties.
Click change setting.
Click advance tab.
Click Environment Variables button.
In system variables area click new button.
Set ANDROID_HOME in the Variable name field.
Set C:\Program Files (x86)\Android\android-sdk in the Variable value field.
Click ok button.
Double click Path variable in the list.
Click new button.
Past C:\Program Files (x86)\Android\android-sdk\platform-tools in the filed.
Click new button again.
Past C:\Program Files (x86)\Android\android-sdk\tools in the field.
Press enter 3 times.
That's all you need to do.
The main reason of this would be the path ( ANDROID_HOME ) is not set in appium. You can confirm that by checking the last step first
step 1 :- Checkout the path where android sdk is located
it could be in c drive/program files or below location mostly
C:\Users\yourUserName\AppData\Local\Android\Sdk
Step2 :- Set the System variables . By typing in search bar in window (you can open this window for setting system variables)
Last step :- To confirm the problem will not repeat verify this, Open appium click on edit configuration and confirm if you can see the path set
It's is mostly with missing andriod SDK. for this issue and "JAVA_HOME" error following solution worked for me... whole day saved after following steps.
To build and run apps, you need to install SDKs for each platform you wish to target. Alternatively, if you are using browser for development you can use browser platform which does not require any platform SDKs.
To check if you satisfy requirements for building the platform:
$ cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-19,android-21,android-22,android-23,Google Inc.:Google APIs:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:23
Gradle: installed
Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X
Error: Some of requirements check failed
By the way, one other possibility is that you do have a too old version of cordova android platform.
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.
Then:
cordova platform update android --save
if Linux users still have the same error, probably they have used "sudo" for adding android platform.. a quick solution for this here, or you have installed cordova using sudo, also there is a solution for this problem here.
Hope this help!
I also faced this same issue, I got a solution with this.
I did the following steps :
Open system properties
Environment variables
create a new system variable
name: ANDROID_HOME
value: copy your SDK path( Ex: my SDK path E:\SoftWares\Android-SDK)
close your current cmd, and restart it
run flutter doctor
this should work on windows
I encountered this error and I had to set the ANDROID_HOME using bash_profile.
Then run the source ~/.bash_profile before running appium from terminal.
You can set the ANDROID_HOME variable from inside Visual Studio as well:
Go to Tools->Options->Cross Platform->C++ and enter the path under Android SDK.
If nothing else works, make sure that you have correct permissions and ownership set up during building. A quick fix can be:
sudo chown -R <you>:<your_group> *
sudo chmod -R 755 *
How to set gradle home while importing existing project in Android studio. While trying to import I need to set up this path.
The gradle plugin (which contains a bundled version of gradle) should be already installed in where/you/installed/android-studio/plugins/gradle so you shouldn't need to manually download it. Depending on the version of Android Studio, that last directory may be where/you/installed/android-studio/gradle/gradle-x.y.z (x.y.z is the version, so check your filesystem for the exact path).
If you intend on doing gradle development outside Android Studio or want a different version, you can download it separately and point it at that path, but if you only want to get Android Studio working with the bundled version, this path should do it.
For Mac OS, you can use the following -
/usr/local/opt/gradle/libexec/ or more generically - path/to/gradle/libexec/ - this is recommended. (the first path is what's achieved after installing gradle via Homebrew)
/path/to/android/studio/plugins/gradle - I don't recommend this because this version of Gradle might be out of date, and Android Studio itself might say it's incompatible.
You should be able to find it in C:\Program Files\Android\Android Studio\Gradle\Gradle 2.2.1. This is running Windows 7 64-Bit. Android Studio 1.0.2.
OSX (Less han two minutes)
Open terminal
Check if Gradle installed gradle --version, if so, goto step 4
If not brew install gradle and Goto step 2
Copy /usr/local/opt/gradle/libexec/
Paste it in Import Project Window in Android Studio > Gradle Home
Important, Celebrate!
Download Gradle http://www.gradle.org/downloads
Install
Set Gradle home to the install directory
On Linux run: whereis gradle.
For me it was /usr/lib/gradle/1.10.
I ran into same problem. I selected location C:\Program Files (x86)\Android\android-studio\plugins\gradle as Gradle Home
In Ubuntu 14.04 after $ sudo apt-get install gradle
I've got
$ whereis gradle
gradle: /usr/bin/gradle /usr/bin/X11/gradle /usr/share/gradle /usr/share/man/man1/gradle.1.gz
The path to Gradle was /usr/share/gradle
For Mac,
/Applications/Android Studio.app/Contents/gradle/gradle-3.2
Download Gradle as described above, but make sure you download version 1.9 and not the current release (1.11). I just had the same problem and downloaded the current release only to have Android Studio tell me it wasn't supported.
On Arch Linux I could not find it, so I added:
echo $APP_HOME
to /usr/bin/grade (found over which gradle)
The Install dir for me was /usr/share/java/gradle/
For migrating from eclipse to android studio
(Do not need to specify the Gradle home.)
Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.
In the following dialog, leave Use gradle wrapper selected and click OK.
Try this for windows users
http://blog.blundell-apps.com/setting-up-android-studio-gradle-windows-7/
I tried byteit101's solution but whether I chose android-studio-path/plugins/gradle or android-studio-path/plugins/gradle/lib the IDE said it isn't correct.
Then I changed the gradle home to android-studio-path/gradle/gradle-x.x.x and it works.
Mac OSX / Linux
Step 1: Open terminal :)
Step 2: Open .bash_profile in vim to edit:
> vi ~/.bash_profile
Step 3: Add line:
> export GRADLE_HOME=/usr/local/opt/gradle
(for me it was this location, it can be different for u)
Step 4: Add line:
> export PATH="$PATH:$GRADLE_HOME/bin"
(to export bin directory of gradle)
Step 5: Verify by reopening the terminal or new tab, and check by echoing:
> echo $GRADLE_HOME
On Linux Mint 17 it was
/usr/share/gradle
for me
If you are on a Windows machine, go to the directory:
C:\Program Files\Android\Android Studio\gradle\
Click the gradle-4.4 folder from Android Studio\File\Settings, and then click the Apply button.
This is my solution on AndroidStudio/Idea for Mac
$ env | grep GRADLE
GRADLE_HOME=/usr/local/Cellar/gradle/2.6
GRADLE_USER_HOME=/Users/leon/.gradle
I used umake to install android studio. For me the path was
/home/user/.local/share/umake/android/android-studio/gradle/gradle-2.14.1
I had to use this
"C:\Program Files\Android\Android Studio\gradle\gradle-4.1"
Change the version if you have a different one.
I am using Lubuntu, I ended up finding it in :
/usr/share/gradle
Don't need to download or specify anything...
Just go to the install Android Studio plugins Path and search for any file like gradle-wrapper-x.xx.jar (x.xx = version number). Copy it to a subfolder of your project root folder named : gradle.
Example :
- file found gradle-wrapper-1.12.jar in plugins folder of Android Studio Install's path
- my project was on D:\android_repo\myProject
- created a folder into D:\android_repo\myProject\gradle
- copy gradle-wrapper-1.12.jar to this folder D:\android_repo\myProject\gradle
- import again my project and no more question about gradle.
In Windows
..\AndroidStudio2.0Beta6\android-studio\gradle\gradle-2.10
I've stumble across this question, trying to build an Ionic + Cordova app using Gradle from Android Studio installation, rather that installing Gradle separately.
On Centos, the Gradle binary was here: /home/YOURUSERNAME/.gradle/wrapper/dists/gradle-VERSION-all/CUSTOM_HASH/gradle-VERSION/bin
So, I've added export PATH=/home/maxim/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1/bin:$PATH to my ~/.bashrc and ionic cordova run android command worked just fine.
If you are on windows machine, go to the directory C:\Program Files\Android\Android Studio\gradle\ and click the gradle folder and apply it on
This worked.
C:\Program Files\Android\Android Studio\gradle\gradle-3.2
If you're using MacPorts gradle's home is:
/opt/local/share/java/gradle
For Ubuntu default version is /usr/lib/gradle/default.
In case of update, you don't need to reassign link in idea/studio.
For OSX, if going to Finder, navigate to this category: /usr/local/opt/ if you do not see gradle folder, install your grandle version manually:
https://services.gradle.org/distributions/gradle-5.4.1-all.zip
https://services.gradle.org/distributions/gradle-4.4.1-all.zip
If you are looking for specific Gradle version, simply change the version number from the zip links above, unzip and add that in the Gradle folder /usr/local/opt/gradle
If you are on a Windows machine, gradle home is located inside the installation folder of your Android Studio, usually at:
C:\Program Files\Android\Android Studio\gradle\gradle-5.1.1
Change the version if you have a different one.
On Windows it was
C:/Android Studio/jre