Android Studio Gradle not working - gradle

I tried lot of different solutions but none of them is working and still getting error
Gradle 'MyApplication' project refresh failed
Error:Error:No cached version listing for com.android.tools.build:gradle:0.12.+ available for offline mode.
I tried:
Uninstall/install android studio
Remove .gradle folder from user directory
Change 0.12 to 1.12. in gradle properties
Enable Use local gradle distribution in gradle settings.
any suggestions how can I fix this.
I also tried various solutions mentioned in stackoverflow but none of them is working.

Fixed the issue, please follow these steps
Goto "File->Settings" in the settings window choose "Gradle" and under the "Globle Gradle Settings" unchecked the "offline work" check box and click "Apply" & "ok".
Do Gradle sync or restart the IDE.
Once Gradle build is success, can check the "offline work" again.

Related

Module Not in Gradle View [duplicate]

I've a big problem with Android Studio.
I have a project that depends on two other projects (as libs).
I followed the guide Problems importing project into Android Studio regarding ActionBarSherlock for import external modules.
I opened "Project Structure", imported the module, but after that I can't see it in the Modules area.
The Modules area contains only the root module, seems it is not refreshed (this is strange). So if I try to add the module as a Dependency, Android Studio doesn't find any module!
Then, if I try to re-import the module, it says that the module/project is already registered!!
Maybe I'm missing something, but I don't know what....! I have this problem both on Windows and MacOSX.
Thanks in advance,
Federico
Look around in your .idea directory for mentions of the problematic project. I had the same problem and resolved it by deleting the entry from .idea/sbt.xml.
In ij go to menu: View -> Tool Windows-> Gradle
Right click on the problematic module and click Refresh External Project, You should see the module in project explorer.
I had a similar problem with ABS and other library imports. The 'Project Structure' interface just wouldn't show the modules. On trying to import the modules, it would prompt, "The project is already registered". Seems to be an IntelliJ/Android Studio issue. Invalidate Caches option didn't help.
Reimporting the project after some cleanup did work for me.
As a precaution, take a backup of your project and store it safely
Ensure that your project builds via gradle command-line and you have all required dependencies specified in respective build.gradle files. Try building with: gradle clean && gradle build
Close the project in Android Studio (or close Android Studio)
Delete .iml files and .idea folders from all modules and the main project
Start Android Studio and reimport the project (Import project from external model > Gradle)
you should remove the project from respective gradle/sbt/maven/ant tab (used to be on right vertical line of Android Studio/Intellij IDEA)
See this answer: https://stackoverflow.com/a/30442195/907576
My issue was fixed when I restart IDEA.

Eclipse is not functioning (f3, ctrl+space, Open Implementation via ctrl, Compile errors) correctly after i imported my Hybris project.

After i imported my Hybris 6.3 extension and custom extension to eclipse, it is not working properly in some extension(project) and working fine in other(project), even it is not showing compile error. I have re-installed other eclipse version like Neon and photon but it didn't worked out.
I have tried deleting the .metadata folder from my workspace but the issue still persist.
i tried opening eclipse.exe -clean from command prompt but it is not getting corrected. This is giving me a hard time. Please suggest me a fix.
If any other IDE could be used instead which is compatible for Hybris then i would try switching it.
Any help would be appreciated.
I don't think the problem you are facing is because of Hybris extension.
You can try
Download/Install Eclipse
Create new workspace
Install the Hybris Plugin from the eclipse marketplace
Import the platform (Click on Import > select Import SAP Hybris platform > select the platform path), the eclipse will import other dependent projects.
This is an Eclipse related issue generally.
Try importing your extension projects alongwith the platform ext. project in an usual manner through "Import existing projects into workspace" followed by selecting all the projects and pressing F5 (Refresh).
If the issue persists select all the projects again and click on Projects -> Clean (Can be found on the tool bar along side File and Edit)

Android Studio Gradle offline Gradle Cache

Android Studio Version 3.1.3
Issue:
Gradle wants to re-download dependencies that were previously downloaded
For instance: "No cached version of com.android.support:appcompat-v7:27.1.1 available for offline mode."
It doesn't matter which version I use, it refuses to accept the ones located at "/~.gradle/caches/transforms-1/files-1.1/"
I have specified gradle service directory path (where the downloaded dependencies are) and ticked the "Offline work" option. I've tried using the default gradle distribution and a local gradle distribution "gradle-4.8.1-bin".
Am I missing something?
Does that mean that gradle only uses per-project cache? Do I have to download dependencies every time that I create a new project?
If so, is that a way to use the already downloaded dependencies?
Also, may I ask why does Android Studio has a tick option to "Work offline"? What is it used for?

Build Configuration - Build checkbox not checked by default

I've recently noticed that when I add projects to an existing solution, the Build checkbox is not checked automatically. Consequently, when I try to run my application, it fails because I forgot to modify the build configuration.
I'm sure that my projects were automatically building before, and I don't remember changing any settings.
My google-fu has failed to find a solution to this minor, but annoying, issue. Is there a setting to tell Visual Studio to automatically check the Build checkbox when I add a project?

m2e will not run on server [duplicate]

I'm trying out the next version of Eclipse using the latest milestone build and I'm having an issue getting my Maven project deployed to Tomcat.
Previously in Eclipse 3.6, my project was automatically enabled as a web project when checked out from SVN. I've checked out my project in 3.7 but get nothing indicating it's runnable as a web project (e.g. trying to run the project doesn't give me the usual "Run on Server" option).
What I've installed is Indigo RC4 "Eclipse IDE for Java EE Developers" version. I then added the latest M2E milestone from here. This enabled me to get up and running, check out my project and I seem to be able to build the project fine (which does create my .war file for remote deployment). Still no "Run On Server" options though.
Does anyone have any clues on what I could be missing? I'm guessing it's a Maven & WTP integration plugin but I haven't spotted the right one yet.
Before m2e became an eclipse project the WTP integration shipped with the core module. Now the core module is an eclipse module and the WTP integration is shipped separately. The current Indigo snapshots of m2eclipse-wtp can be found here. I was unable to get any artifacts from this update site however, even though it's listed in the corresponding JIRA issue.
Fortunately, today m2e-wtp was made available through the m2e Marketplace. Just open the eclipse preferences, go to 'Maven' -> 'Discovery' -> 'Open Catalog' and install it. .
It will work with the lastet version, it's just the .project that is not right.
Simply go into the project properties, make the projet faceted.. tick Dynamic Web Module and you'll get run on server as an option after that.
This will enable the "Run on Server" option, however your problems don't finish there as when you then run it, you'll get a 404.
To fix this, go back into project properties, Deployment assembly.
Delete the WebContent entry (and you can delete the folder in the project later too), and make sure you have the src-main-webapp & src-main-resource folders added.
Bingo.. run the app and it should be fine.

Resources