Invalid Gradle JDK configuration found? - android

I am very new in Android Studio. I have a problem with gradle.
it says,
Error:Invalid Gradle JDK configuration found.
Platform SDK does not point to valid `JDK` `(C:/Program Files/Java/jdk1.8.0_20)`.
Consult IDE log for more details (Help | Show Log)
then what should I do to solve that?

I got this issue in Android studio 4.2 canary, and I had to delete those generated files:
.idea/gradle.xml
.idea/workspace.xml
then clicking try again to sync the project.

Under Android Studio, select File > Project Structure > JDK location.
Specify the JDK to the folder of your currently installed JDK. And specify the SDK location as well.

Simple solution:
Go to build.gradle and at the top there will be a message JDK missing
Click on it and use JDK from the list (or download one if you don't have)
Sync project

I got this issue in Android Studio 4.2.2, and the solution is very simple, just delete
.idea/gradle.xml
.idea/workspace.xml
and click on
File -> Invalidate Caches/ Restart

If you want / need to, update your JDK installation to the version that you want to use.
Next, find the version for your current JDK installation by running javac -version or java -version. Check that it is what you expect.
Next, find the JDK installation directory:
It should be on your %PATH%.
By default it will be a subdirectory of "C:\Program Files\Java"' for example: "C:\Program Files\Java\jdk1.8.0_45"
Next, start Android Studio, and go to the "File->Project Structure->JDK Location" preference page.
The file path given by the preference should be the path to the JDK installation director that you identified above. If it isn't then update it.
Notes:
Use the full pathname of the installation directory; e.g. "C:\Program Files\Java\jdk1.8.0_45".
Use a pathname, not a URL.

This Problem occurs when you open your Android Project in Another Computer.
To Solve this,
DELETE your .gradle and .idea folder from your project.
Invalidate Cache and Restart Android studio
After Restart, SYNC Again to automatically create new .gradle and .idea folders

Just delete .idea and .gradle folders from your project path on your computer and sync again.

This issue happens if you change the workspace or manually copy files to the new repo workspace. i fixed it by deleting below files,
.idea/gradle.xml
.idea/workspace.xml
Finally click on File-> invalidate cache and restart

For Android studio Canary Build Arctic Fox 2020.3.1 this seems like a bug or hard dependency with Jdk 11.
I already had jdk defined, but I was still getting this error. Got resolved after installing jdk 11 and providing path to it in the jdk location here
File > Project Structure > JDK location

I have solve this problem my App name "Addvoicetomusic2";
go to app dir-
C:\Users\amram\AndroidStudioProjects\Addvoicetomusic2
then remove .gradle and .idea file
*then connect to internet
restart android studio project
successfully solve

Solution for Android 4.2.2
Terminal commands:
rm .idea/gradle.xml
rm .idea/workspace.xml
Finally click on File-> invalidate cache and restart

The simple and easy way is
Go To Your build.gradle(Module:app)
At the top right corner you will find notification JDK is missing or download missing JDK
Clik on that notification and download JDK and Sync Project.

SIMPLE SOLUTION
-go to build.gradle and at Top there missing JDK right side configuration or download options to click and install JDK and have a already JDK then select it. Otherwise download better option.
Thanks click sync now or try again.

For macOS:
install JDK from Oracle site
Go to the folder:
cd /Library/Java/JavaVirtualMachines
Here you will see JDK installed.
Set folder in the Android Studio, something like this:
/Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk
I don't why it's not possible to automate such tasks after all this years.

amra ram's solution worked for me, more or less. I had an old .idea directory with a weird configuration. Deleting it, closing Android Studio, and opening the project again forced it to reinstall and sync Gradle.

Go to build.gradle and at the top there will be a message JDK missing
Click on it and use JDK from the list (or download one if you don't have)
Sync project

When I encountered this same problem, I solved it by specifying the path to the portable (non installed) JDK8.

Same error i got when I install android studio on my pc . at the time of installation I have installed android sdk and android studio in different path so In project structure I have set my new sdk path .
Still I got message of invalid jdk ...then I knew location of jdk ,again in project structure I have set my jdk path.It works.

For me the problem appeared after updating IntelliJ to version 2020.2.1.
Just solved it by going to Project Structure -> SDK. There I only had the Java jdk. I've added IntelliJ IDEA Platform Plugin SDK and that seems to have solved the problem. gradle loads just fine.

First you have to delete the folders - .idea and .gradle from the source directory.
Select File > Project Structure > JDK location. Specify the JDK to the folder of your currently installed JDK. Ensure that you have installed the JDK version greater than 1.8. Also specify the SDK location.
Select File -> Invalidate Caches/Restart click Invalidate and Restart

if other answers not work try this
For Android Studio Arctic Fox | 2020.3.1 Canary 15
File -> Invalidate Caches/Restart
click Invalidate and Restart
it works for me

Just clean and rebuild project worked for me.

I had to update to the latest Android build, Android Studio Arctic Fox | 2020.3.1. to be specified to make the project compile.

Go to Android studio settings or preferences and select jdk as shown in image and try syncing project

Just deleted the entire .idea folder from your project and it will work.

If you're working with Android Studio 4.2.2, and you got a zip of somebody's source code, it may often contain the .idea folder. Unfortunately, the .idea folder may contain gradle SDK configuration, etc., that are only valid for the computer of the person who sent you the source code.
Solution:
Ideally, the sender should have deleted the .idea folder before sending to you, but you can still fix it by ..
Delete .idea/gradle.xml and .idea/workspace.xml.
Then do the gradle sync again and the error will go away, and it should be fine.

For me I just did File -> Invalidate Caches... -> Invalidate And Restart(leave the checkboxes above as default)
It will take some time but it worked fine .

Related

Unable to find bundled Java version, after update android studio

I have updated android studio, after that i am getting this error.
Unable to find bundled Java version.
unable to find bundle java version
for solving this error on mac just go to finder>Apllications>Android studio:
right click and click show package contents
open the folder of contents
create a new folder called jre
copy the contents of the jbr folder and paste them into jre folder
delete jbr folder
run flutter doctor your error is solved 😊
Try restarting the Studio, reinstall it or Invalidate Caches from File. I am sure one of it will work. The package could be missing in the update. If it doesn't work, open a issue at here
If Just kidding's answer does not work you can just reinstall Android Studio (don't forget to load the Flutter and Dart plugins) and it should be fine again.
My path to java was broken after updating AS to latest version (2020.3.1) and I had to fix it manually. Your issue seems related. Check your Android Studio -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle and see if gradle jdk path is set correctly (to your java installation on your mac).

Error:Failed to open zip file. Gradle's dependency cache may be corrupt

I updated android studio 2.3 and there is a bug, gradle doesn't build and it keeps giving me the same error for all projects.
Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)
I have already searched for a solution, but have not found any. I tried:
Invalidate Caches / Restart...
but nothing has changed.
Repair Gradle Installation
This usually happens when something goes wrong in Android Studio's first launch (eg. system crash, connection loss or whatever).
To resolve this issue close Android Studio and delete the following directory's content, necessary files will be downloaded on IDE's next launch.
macOS: ~/.gradle/wrapper/dists
Linux: ~/.gradle/wrapper/dists
Windows: C:\Users\your-username\.gradle\wrapper\dists
While downloading Gradle manually works, I recommend letting Android Studio do the work for you.
UPDATE 17 JULY 2018:
Even if the following solution still works as of today,I've found (thanks to the answer posted by Hamid Asghari and to the comment posted by Mahendra Dabi) that simply deleting the gradle dist directory and performing a reboot of the ide, will fix the issue (please read Hamid post for a full answer, and remember that OSX and Linux have the same gradle path).
If you still want to follow my original solution, you should at least consider using a more up-to-date version of Gradle (direct link of the gradle distribution repo: https://services.gradle.org/distributions/)
Original answer (dated 7 March 2017):
I've faced the same issue this morning after upgrading Android Studio to 2.3.
To solve the issue:
1) Manually download Gradle 3.3 binary (direct link: https://services.gradle.org/distributions/gradle-3.3-bin.zip)
2) Open your android studio root directory, and extract the zip to the gradle folder (for example in my Debian machine the full path is /opt/android-studio/gradle/gradle-3.3)
3) Open Android Studio, go to File->Settings->Build, Exectution, Deployment->Gradle and set "Gradle home" to point your new gradle-3.3 folder.
4) Sync and you are ready to go!
I faced the same issue 2 days ago and today I was able to solve it like this:
Go to this path C:\Users\user_name\.gradle\wrapper\dists where user_name is your username if its you own PC or your company's name.
Delete the latest gradle-****-all files since your latest update of android studio (ex. 2.3 or another version).
If your android studio is open, close it then reopen it. A newer Gradle version will be downloaded, it will take time depending on your internet speed, the download size is around 150-200 MB before extraction so if android studio takes a long time to refresh just know its downloading. (To check the download progress right click on the new gradle folder, go to properties and check the size).
Find 'gradle-wrapper.properties' in root project
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Change "https" to "http".
There are Following Steps to solve this issue.
1. Go to C:\Users\ ~User Name~ \.gradle\wrapper\dists.
2. Delete all the files and folders from dists folder.
3. If Android Studio is Opened then Close any opened project and Reopen the project. The Android Studio Will automatic download all the required files.
(The required time is as per your Internet Speed (Download Size will be about "89 MB"). To see the progress of the downloading Go to C:\Users\ ~User Name~ \.gradle\wrapper\dists folder and check the size of the folder.)
just remove and reDownload wrapper gradle.
Mac Home/.gradle/wrapper/dists/
remove gradle version and sync gradle in project and run project.
Go to Project pane> Android > Gradle Scripts and open "graddle-wrapper.properties" file check the distribution URL:
Go to your ".gradle/wrapper/dists/" folder and remove that file for me it was "gradle-5.6.4-all"
Then go back to android studio and click on File > Sync Project with Gradle Files. And it will start to download again
****Following solution is working for me****
Manually deleted all files from C:\Users\Admin.gradle\wrapper\dists\
where Admin is my user name
Android Studio 4.1.1 has this bug,
In gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
This won't download and always gives 'gradle cache corrupt' error, but a small change makes it work fine
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
Now sync the gradle again and it's done.
1.Go to "/Users/****/.gradle/wrapper/dists/gradle-.-all/*****".
2.Delete the "gradle-.-all.zip.lck" file.
3.Invalidate Cache and Restart.
you do not need to clean all files in dir
C:\Users\ ~User Name~ \.gradle\wrapper\dists.
and download all of them again
instead you can just delete the folder of gradle version you failed to download. In my case it was gradle-4.4-all so i just deleted that folder and android studio re downloaded gradle-4.4-all for me
In case you don't know version you was downloading:
Just go to help menu > show logs in explorer
their you will find idea.log open it and search for
Could not install Gradle distribution from 'https://services.gradle.org/distribution`
once you find it you will find gradle version you failed to download
This was the best solution for me, just follow this path C:\Users\yourusername.gradle\wrapper\dists then delete all the files inside this folder. Close your android studio and restart it and it will automatically download the updated gradle files.
I was upgrading gradle from 4.1 to 4.10 and my internet connection timed out.
So I fixed this issue by deleting "gradle-4.10-all" folder in .gradle/wrapper/dists
Taking a cue from #Mikel Yang, I found out that instead of deleting the ~/.gradle/wrapper/dists/ folder (which will means downloading the gradle files for different apps on my Android Studio), I decided to change the gradle.wrapper.properties file to any latest gradle --all.zip. So
Find 'gradle-wrapper.properties' in root project
distributionUrl=https\://services.gradle.org/distributions/gradle-{lastest}-all.zip
this way l get to save some data and time.
This happened to me because of a partially downloaded gradle distribution zip
To resolve simply go to below path
"C:/Users/your_username/.gradle"
OR
pull your gradle path from
File->Settings->Build, Exectution, Deployment-> Gradle -> gradle service directory path.
Delete the partially downloaded distribution gradle folder
Go to Studio (no need to restart) and perform gradle sync
Go to "File" in android studio, Click "invalidate caches/Restart" and "Invalidate and Restart"
That also works
I faced the issue, In my understanding, It is because of invalid combination of Android Studio And Gradle Plugin versions. I was using Gradle version 5.4.1 and Studio version 3.4, hence I updated the Android studio to 3.5 and the issue got resolved
You can delete the latest gradle-.-all folder from the below path
Windows: C:\Users\your-username.gradle\wrapper\dists
find file gradle-wrapper.properties
update with :
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
1). Android studio-> file-> "Invalidate Caches/Restart" -> "Invalidate and Restart"
wait for gradle sync
2). Download gradle.x.x.x-bin.zip using browser
unzip it and place it in ".gradle/wrapper/dists/gradle-x.x.x-bin\xxxxxxxxxxx(auto generated folder)/
then restart android studio

Android Studio 2.2 Stuck at Building Gradle Project Info on importing existing project

I am using Android studio 2.2 on windows 10.
I am trying to import an existing android project. The problem that it took forever and still showing the message
Building 'ProjecTName' Graedle project info
after that android studio is totally getting stuck and i kill it from the task manager !
I tried the available options on Android Studio list:
Open an existing Android Studio Project
Import Project (Eclipse ADT, Gradle, etc.)
There is downloading of Gradle going on at the background. Just wait for it to finish.
Just Remove Gradle files from your project folder and retry.
Hope this will help.
I also had the problem.
I downloaded the gradle 3.5 binary distribution zip file, deleted the gradle folder from my project, then went to settings of Android Studio, checked "Offline work", used "Use local gradle distribution" and set the path of unzipped gradle folder
on the "Gradle home" and "Service directory path" text fields.
Then I tried to open the project with Android Studio 2.3.
Then a message is shown and I pressed cancel to manually configure the gradle, then I located the unzipped gradle folder again. This solved my problem.
Try the following :
1> Try Removing(Deleting) the gradle files from the project folder and then re-try.
2> Try to go into the android studio and then Files>Invalidate Caches/Restart and then try.
3> If the above two don't work do check the gradle,android Studio versions and see if those need updating.
4> Above 3 usually work for me , if it still persists, then you need to check the dependencies for the project. Also try importing some other project and if the same issue occurs, try a new installation of a STABLE version of the android studio.
Try to remove C:\Users\User.gradle
I had deleted all gradle folder and copied it from another project and pasted it, this worked for me
The above answers didn't work for me well.
I have several projects with different gradle versions, and whenever I tried to open a project the Android Studio started downloading its gradle in the background.
So, things to do before importing old projects to new Android Studio / Gradle.
In file 'build.gradle' replace old line with "classpath 'com.android.tools.build:gradle:2.3.3'"
(Assuming 2.3.3 is the latest. You can check this in your newly/recently created project)
In file 'gradle/wrapper/gradle-wrapper.properties' replace old line with 'distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip'
(Assuming 3.3 is the latest. You can check this in your newly/recently created project)
Now when you'll import, it wont download other gradle version.
I did find-replace for the above lines in my whole directory containing all my old projects, using Notepad++.
Actually the real Problem is that the studio is downloading gradle files throught internet and sometimes it is not able to do so, then it stucks but we can manually fix it through-
Download Gradle Files according to your android Studios version.
You can download gradle files through-https://services.gradle.org/distributions/
See your Gradle vesrion through-https://developer.android.com/studio/releases/gradle-plugin.html in the Update Gradle area.
Download the Gradle and paste it into- c:/Users/username/local/.gradle
and this is It!!!
I found that my gradle files had the gradle version set 2.1.0. So I opened the files in wordpad and first changed that to 3.3 And then it worked fine for me.
And in the gradel-wrapper.properties:
From distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
To distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Hope that will solve the problem
This worked for me.. Will work for you for sure.
step 1: Delete "only" the Gradle "folder" from your project folder.
step 2: Import your project from Android Studio & a dialog box will appear "press
Ok to use..., or Cancel to... ". Press "Cancel" & locate the path where you have downloaded the latest Gradle File (C:/Gradle/gradle-3.5 ,in my case).
Step 3: it will give an error saying that "no cache version for....". So now check which version of com.android.tools.build:gradle: you have.. so check the path "C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle" and select the latest version (2.3.2 in my case). So now, go to Gradle Scripts-> build.gradle(android) in Android Studio and change the dependencie's classpath to (classpath 'com.android.tools.build:gradle:2.3.2')in my case
step 4: Click on "try again". Then it'll ask for upgrading tools, upgrade it by clicking on it & then you're done..
Congrats, your Project is successfully built..
And yeah make sure that In Setting-> Build,Exec...->Gradle-> "check mark on Use local gradle distribution & offline work & Gradle home: C:/Gradle/gradle-3.5 & Service directory path: C:/Gradle/gradle-3.5 (in my case).
Deleting temp and temp% worked for me!
Download manually gradle-3.3-all.zip
and extract into /Users/[yourUsername]/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/

Studio: Gradle project sync failed.

I tried some solutions but none of them helped.
I can't compile anything because of gradle's error:
Error:C:\Program Files\Android\Android Studio\gradle\gradle-2.8\native\jna\win32-amd64\jnidispatch.dll (System can't find this path)
In Settings I tried to check "Use default gradle wrapper (recommended)" but it comes back to "Use local gradle distribution" with path C:\Program Files\Android\Android Studio\gradle\gradle-2.8
I downloaded gradle 2.8 from the official site but there's no "native" directory.
I updated everything with SDK and restart Studio but it also didn't help.
Android Studio 1.5.1, it's the same with all projects, even the new ones.
How can I fix this?
I got the same problem when switch to another computer. It's because project is keeping the reference to another computer paths.
For fix it i did:
I deleted the .idea folder from the project, like the highlight from image bellow.
Then you have to remove the project from android studio and open it again.

AndroidStudio SDK directory does not exist

I am using Android Studio for a project on SVN (usually on Windows PCs).
Lately I want to run this on a Mac, it keep giving the below error:
Error:The SDK directory '/Users/AhmadMusa/Desktop/[PROJECT PATH]/D:\Android\sdk' does not exist.
Please fix the 'sdk.dir' property in the local.properties file.
I already put the SDK on local.properties file as:
sdk.dir=/Users/AhmadMusa/Library/Android/sdk
I don't know why it keep adding the (D:\Android\sdk) automatically, this is my Windows PC SDK directory, but why it is here now! nothing on code mention any D:\Android\sdk.
Right click your project and select 'Open Module Settings' under SDK Location put your location for your SDK.
paste in /Users/AhmadMusa/Library/Android/sdk
Clean and rebuild your project
Update
Try to delete your local.properties file and create a new one, but do not check it into version control.
Right click top level of project and Create new file 'local.properties'
then add: sdk.dir=/Users/AhmadMusa/Library/Android/sdk
Clean and build
I finally find this file on the disk.The 'local.properties' file in The Android studio is not which you modify.see the picture,so you can modify this line 'sdk.dir' to your dir of sdk.Remember not in the android studio.
This is a problem when you open the project incorrectly. open the project do not import the project
Create or edit file local.properties under android directory
For window path should be like this
sdk.dir = C\:\\Users\\user name\\AppData\\Local\\Android\\sdk
For linux system path should be like this
sdk.dir = /home/user name/Android/Sdk/
Open your project folder
open local.properties in notepad++
change sdk.dir to C:\Users\xxxx\AppData\Local\Android\Sdk
save
After edit, resync again android studio.
I solve this problem, the reason is: You downloaded other's projects. His local.properties file content is his SDK path. You must replace SDK path with your local SDK path, then rebuild the project.
From Android Studio 1.0.1
Go to
File -> project Structure into Project Structure
Left -> SDK Location
SDK location select Android SDK location (old version use Press +, add another sdk)
Change the sdk path to /Users/AhmadMusa/Library/Android/sdk
I solved this issue in Windows using this format for the full path:
sdk.dir=C:/Users/xxxx/AppData/Local/Android/Sdk
I think you should go to:
File ->Project Structure->SDK Location->
there select your sdk location.
Just open your local.property file
if your project is used in mac before, so the sdk path will be something like
sdk.dir=/Users/siddharthyadav/Library/Android/
Now if you are trying to use that in windows so just edit and put your sdk location:
Example:
sdk.dir=D:\software\android-sdk\android-sdk
Just clean and build. See it works!!!
Just close your project and re-open it again.
Than SDK message appears click ok.
Today upgraded to Android 3.3, which broke everything for me.
This one was related to importing the project, not opening it.
Solution which worked for me, was to import the project. During the import it detects that the SDK directory is missing and proposes to open it from a location which actually exists. It worked in my case but your case might be different.
Many other changes still needed to be done to make old projects work. What a pain any update is. I wonder why don't they do a thorough QA first before releasing these updates. It has become an industry norm to release problem filled software, probably thinking that users will figure out solutions via Stackoverflow.
I had the same problem. Just open the project main folder. and then close and reopen the project sub folder app.
In my case, my project is located inside another Android project.
Therefore, I opened the local.properties of the parent project and fix the sdk.dir's path there.
Select SDK Location: File->Project Structure->SDK Location->
Close Android Studio.
Remove .gradle and .idea folders, local.properties, all .iml files in the project: <module_name>/<module_name>.iml
Open Android Studio and select Open an existing Android Studio project
Select path to your project
This way must to help.
Checkout your SDK manager in Android studio, if you have partially installed sdk. Install SDK completely and try running your code.
I had a ; in the environment variable name, put it out and it will works !
refollow the steps after the verification of the ANDROID_HOME
react init
=> run you emulator
=> run-android
sdk.dir didn't work for me because I had ANDROID_HOME environment variable with wrong path. So, solution is just to update ANDROID_HOME or remove it to use local.properties.
Android Studio restart is required after the change.
I faced the same problem - it was solved by only the following step.
I deleted all created .idea and .gradle folders.
It is the path problem I faced while loading source in SDK, I think.
If you have set the ANDROID_HOME variable, just remove or comment that line in local.properties file. It is the solution for me
in latest Android Sudio 3.2.1
1- you will see two files with the name 'local.properties'
2- one will be inside folder named 'app' ( app level folder ), Only if you have not yet been able to sync your project. if you cant see it in the folder strucrure in Android studio then physically find this folder in Finder . (right click and reveal in finder in case you use a MAC machine). Make changes here.
3- and other will be inside 'gradle script'
make sure you have same path there . Also make changes here (if you can see this file)
Basically find this file at its physical location in the project folder (physical location ) and make changes
eg. : sdk.dir=/Users/Rakesh/Library/Android/sdk
in both the files .
My solution: open app on Android studio.
Check sdk and clean App, after rebuild I had fixed this problem by following suggestions of Android Studio.
finally run app with react-native run-android/ios
This might due to merge conflict same as mine, try to change local.properties for me it was wrong location for android sdk as it was override from other machine
ndk.dir=/Users/???/Library/Android/sdk/ndk-bundle
sdk.dir=/Users/???/Library/Android/sdk
then rebuild
If your project is a subproject, the problem may lie on the parent local.properties file. I may suggest you to go up in the project hierarchy to the root file and execute the following command:
$ find . -type f -exec grep -l sdk.dir {} \;
That would work on OSX and Linux, if you are in Windows you may need to install Cygnus tools or something akin (I don't use Windows, so I cannot be more precise). If the path is wrongly set in some file, you'll find it with that command, then it is just a matter of opening the file with a text editor and replacing the wrong path with the right one.
My scenario is I open the project, and the local.properies shows my sdk.dir.
But it keeps telling me it need the sdk from the previous other user's dir.
So I close the project and re-import the project, and everything works fine.
Choose one of the options-
OPTION A
Delete the 'local.properties' file in 'Gradle Script'
Create new 'local.properties' file there
Paste this into your new 'local.properties' file
sdk.dir=/Users/uttam/Library/Android/sdk
OPTION B
copy the 'local.properties' file from your any old project.
paste this in your new project, you will be asked confirmation, choose 'replace'
HAPPY CODING :)
Fix the root cause. If you check the other answers they suggest to find the SDK location property and fix that. Assume you have that correctly set, otherwise you won't have any SDK components downloaded on your system. Then something in your environment is telling AndroidStudio where to find the sdk.dir. Since AndroidStudio will create this local.properties file for you, it is likely first checking the stored property of "Android SDK" System settings for this location. It should use this value in the local.properties. If you find that it still gets the wrong value, the root cause is that AndroidStudio fills the sdk.dir property from ANDROID_HOME, found in the host system environment. Fix this and it fixes the problem. You will need to (1) correctly set ANDROID_HOME or unset the variable for ANDROID_HOME (2) remove the existing local.properties (3) restart your AndroidStudio.
You need to change sdk.dir='...' in local.properties file as per your sdk location.
For checking sdk location, open File -> Project Structure -> SDK Location. If sdk location is also not correct there, you can also update it.
Go to your project_folder/platform/android/
Open local.properties in your text editor
Change URL with your SDK URL
sdk.dir = C:\Users/Pcesolutions/AppData/Local/Android/Sdk
Now run your command in windows
Its worked for me. I think, it work's also in your PC.

Categories

Resources