Installing Android Studio issue with .gradle file - android

I just install android studio on a VM machine (VM Fusion). When I try to create a new project, I get the message "org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'."
I followed the suggestion found in the page.
Download Gradle directly from
http://services.gradle.org/distributions/gradle-1.6-bin.zip
Copy the contents of gradle-1.6 to
\Android\android-studio\plugins\gradle
Copy gradle.jar to \Android\android-studio\lib\
Restart Android Studio
It did not work. I get the error message
I tried to copy the zip package /gradle-1.6-bin.zip to the following location
C:\Documents and Settings\myusername.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
the .gradle file was not there. I look in setting and notice that it under \vmware-host\sharefolders. I went there and the file was still not there. I unhide hidden file and folder with no luck.
In addition, when I create a new project, I notice the project location is \vmware-host\Shared Folders\AndroidStudioProjects\MyApplicationProject.
How can I get a new .gradle file or tell android studio to look at a different folder? How do I change the project location so it does not default to \vmware-host but instead to c:\development.
Any kind of help would be greatly appreciated.
Thanks,
JF

Copying Gradle inside Studio will not help. Just install it somewhere else and after manually creating a project you can import it in Studio and select which installation of Gradle to use.
You have to create the project manually, because right now creating a project from studio always use the wrapper that automatically download gradle from the online repository.
We are working on having an offline mode for project creation, but it's not available yet.

Just edit your System's DNS settings, and redirect services.gradle.com to 127.0.0.1 then use a small web server and serve the file under its appropriate directory (distributions)

As you said,"Copy the contents of gradle-1.6 to \Android\android-studio\plugins\gradle",this folder under the setup path.
Why did you copy it to "Documents and Settings"?

Related

After update android studio - fail to create new project

After updating my Android studio today I created simple project and I got following error that.
Error:Could not set process working directory to 'E:\DevelopAndroid\myNewProject': could not set current directory (errno 5)
The 'E:\DevelopAndroid\' is exist and the 'myNewProject' folder created.
But still I can't upload the code to my Git server.
I am not able debug it.
And I don't know what to do.
Renaming directory without space
delete .idea folder
Restart Android Studio
It will work
close current project, delete it and create a new same project, it works for me.
under your project-> look a folder(.idea) delete everything in it. then go to file-> select sync project with gradle files click and let your project sync again
I solve this by assigning full control permissions to the root directory in my Windows 10 machine. In my case cdm-webservice-v2 is the project directory.

android studio gradle refresh failed (The system cannot find the file specified)

Error:Could not open initscript class cache for initialization script
'C:\Users\Subash\AppData\Local\Temp\asLocalRepo2.gradle'
(C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript).
java.io.FileNotFoundException:
C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript\cache.properties
(The system cannot find the file specified)
UPDATE:
Check my answer here for full details
I have the latest version of Android Studio and I faced that problem, the only thing that worked for me is to:
1-Navigate to C:\Users\user.gradle\caches\2.4\
2-Copy the folder "scripts" and paste it somewhere safe just in case anything went wrong you will place it back
3-Delete this folder "scripts" from the directory C:\Users\user.gradle\caches\2.4\
4- Sync Project with Gradle Files and you are done.
When you sync your project Android Studio will generate new cash files.
It worked for me I hope it will work for you...
I don't know why a great developer as Google can't manage this issue by them selves it is very easy to delete the cached folder and regenerate it programmatically. Any way just navigate to C:\Users\user.gradle\caches\ and open the latest version folder, then delete the scripts folder. Go to android studio and sync project, that should do it.
Exit Android Studio, remove the Gradle cache folder which path is in the error message, and restart.
You could try to delete this : C:\Users_USER_.gradle\caches_GRADLE_\scripts_XXX_\InitScript\initscript\cache.properties.lock
I had the same problem and after deleting it all works fine.
Another common problem with Gradle is synchronization which is solved adding the correct path of JDK but this is another story.
I hope to help.

Error in building project in Android Studio

Freshly Installed Android Studio and started new android project.
When tried to run it. Got this error from Gradle
Error:Could not open initscript class cache for initialization script 'C:\Users\Dexter\AppData\Local\Temp\asLocalRepo10.gradle' (C:\Users\Dexter\.gradle\caches\2.2.1\scripts\asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv\InitScript\initscript).
java.io.FileNotFoundException: C:\Users\Dexter\.gradle\caches\2.2.1\scripts\asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv\InitScript\initscript\cache.properties (The system cannot find the file specified)
I have tried to rebuild the project and also tried to delete .gradle folder but nothing worked.
I'm having the same problem and deleting just the cache.properties.lock is not enough.
The solution, as pointed before, is deleting the cache.properties.lock file, but not only in the folder pointed by Android Studio. I needed to remove every lock file inside .gradle\caches\VERSION.
So, I created a small .bat file with this:
del /s cache.properties.lock
Add this file to .gradle\caches\VERSION\ and run it. My Android Studio stopped complaining afterwards.
Hope it helps!
Error Message
Error:Could not open initscript class cache for initialization script
'C:\Users\Dexter\AppData\Local\Temp\asLocalRepo10.gradle'
(C:\Users\Dexter\.gradle\caches\2.2.1\scripts\asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
\InitScript\initscript)
java.io.FileNotFoundException: C:\Users\Dexter\.gradle\caches\2.2.1\scripts\
asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv\InitScript\initscript\cache.properties
(The system cannot find the file specified)`
The most important parts of this error message are
- Could not open initscript class cache
- asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
So
Let _XXX_ = asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv
Let _USER_ = Dexter
Let _GRADLE_ = 2.2.1
Solution
Delete
C:\Users\_USER_\.gradle\caches\_GRADLE_\scripts\_XXX_\InitScript\initscript\cache.properties.lock
Does this not work?
Then you have to find out the root solution. This is probably due to a corrupt IDE. Try installing another copy of Android Studio on your system.
Note: You can have multiple copies of Android Studio on your system. Here is the latest Preview. If you check the notes on the page, you can see what you need to do to install a new version on AS.
Let us know if this works...if not, we can try to elimate other possible issues
go to location
".gradle\caches\2.0\scripts\build_7l4t45nbnsvdcl79ol8u0beli4\ProjectScript"
delete cache.properties.lock file
I am also getting the same error.
So what I did is this that I cleared the Temp folder (If you don't know where it is then just hit Window+R and enter %temp% OR you can type %temp% in address bar too in File Explorer).
Now again run the project, it should run fine.
I don't know the permanent solution but what I am telling it works for me.
If anyone do know the permanent fix then please share that.
In my case, it was the roaming profile issue. Gradle Sync failed every time I switched networks from work to home. Although I was able to access the network drives by connecting with VPN, still it used to give this error. I had to move the Gradle Service Directory Path to a different location that wasn't dependent on the network.
You can do this in AS 1.4 by going to File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Service Directory Path. Screen shot below:
You can also add GRADLE_USER_HOME environment variable with the same value of the location for making it a default for every project (http://blog.james-carr.org/2011/05/04/setting-gradle-cache-to-a-common-location/). You may refer to the following page for more info on moving Android related stuff to different locations: http://www.littlecpu.com/android-studio-c-drive
File -> Invalidate Cache / Restart worked for me.
In my case I have deleted .gradle folder and clean the project on re run the project was working fine.
I had similar issues. For me the solution was simply to delete all files inside the folder C:\Users\Dexter.gradle\caches\2.2.1\scripts\ Also i removed VCS configuration from android studio. No need to install new Android Studio to fix the issue.
I have same problem. just restart your Gradle and then clean your project. i hope this help
For Me Issue get resolved by giving permission
For window
C:\Users
Right click on Users >> Click on Security Tab >> Add Group and username there
as for example SYSTEm, your comany mail id
For Linux
provide 777 permission for .android and .gradle folder by using
sudo chmod 777 -R .android/
sudo chmod 777 -R .gradle/

Failed to create new project in android studio 0.2.3

After I updated form 0.2.2 to 0.2.3, I create new project failed.
Error message is below:
下午 08:51:58 Gradle 'NotifyViaGoogleMapsProject' project refresh failed:
The SDK directory 'C:\Program Files (x86)\Android\android-studio\bin\Program Files (x86)Androidandroid-studiosdk' does not exist.
Build file 'F:\AndroidStudioDevelop\NotifyViaGoogleMapsProject\NotifyViaGoogleMaps\build.gradle' line: 9
NotifyViaGoogleMapsProject is my project name,and my android studio is install in default path(C:\Program Files (x86)\Android\android-studio), there has no same error in 0.2.2.
I've figured out the problem.
Open 'local.properties' in your project using a text editor.
sdk.dir=..\\sdk
Save and Close
Now Import your project into Android Studio.
Make sure that the SDK folder you mention exists - I'm not sure if it is a typo or not but the path you specified is a bit weird - it should be
C:\Program Files (x86)\Android\android-studio\sdk
On the menu go to File -> Project Structure, then choose SDKs under Platform Settings. Check that the path for the Android Platform you use is correct, and if not, change it to the correct path. Also make sure that the Project is set to use the correct Android Platform.
I have the same problem.
http://i.stack.imgur.com/pPOOi.png
The SDK is correct in Platform Settings, I have no idea what's causing this problem.
http://puu.sh/3TAFi.png

Eclipse Android won't clean, won't refresh resources

I upgraded to Ubuntu 11.10, Eclipse 3.7.0, ADT 14.0.0.
When I replaced a picture resource in the /res/drawable-nodpi directory on the desktop, or a sound resource in the /res/raw directory, both the recompiled program and the Project Explorer use some previously cached version.
I tried the following, none of which worked:
right-click on filename in project explorer: Refresh
right-click on /drawable-nodpi dir in p.e.: Refresh
right-click on /res dir in p.e.: Refresh
right-click on Project in p.e.: Refresh
Project -> Clean...
Project -> check Build Automatically, Run->Run
The program recompiles new source code changes correctly, but reuses its own cached resources.
This is with an existing project that used to work under Ubuntu 10.
As a workaround, I renamed the file on disk; Deleted the file in the Eclipse Project Explorer; restored the name of the file on disk; and then dragged the file from the desktop into the /res/drawable-nodpi folder in the Project Explorer. Eclipse came back with a popup asking whether I wanted to Copy or Link the file into Eclipse. I chose Link. This finally got the new version of the resources imported.
Update: After the source code that used these images got modified elsewhere, it quit recompiling, saying R.drawable.mypicname no longer referred to anything. So the Linked resources don't appear to be reliable after all. The latest workaround is to manually Copy the file on the desktop and Paste it into the Eclipse ProjEx /res/drawable-nodpi directory. This recompiled without any source code change, and ran on the device.
Both Clean and Refresh not working correctly is quite unexpected behavior. Why is it doing this? What am I doing wrong? How can I set the Eclipse environment so that when I change the file on disk, it uses the current latest version? Or at least allows me to Refresh? Thanks.
Enable lightweight "refresh on access" to keep the workspace synchronized with the filesystem.
This option in Eclipse is in Preferences under General->Workspace as shown here.
Look for bin on your application. Probably there is a folder called res/crunch, so search for your drawable that isn't refreshing and refresh manually.
In my case, I import the wrong 'R' so that eclipse couldn't find the right image file.
try change this: import android.R; => import com.example.myfirstapp.R;

Categories

Resources