Android Studio Gradle not Building Project - android

I was using my android Studio very well. I don't know what happened and now I am getting only Building "xxxx" Gradle project info whenever I want to create my new project. I am unable to open any new project. Please help. I don't have even 10 reputations to upload the screenshot.
I think my Gradle is not working. How can I reset or restart my Gradle ?

I think you have updated your gradle build tool.
Go to file>setting>build,execution deployment> gradle> check your gradle tool version

I had many hours trying to figure this out.
I have followed just about every Stack-overflow article on the issue.
The cause for me was my Anti-virus and Firewall settings. I turned these off, and restarted my Android Studio opened my application I was trying to build it all downloaded what it needed and sync'd nicely. Problem solved, relief as I have been literally days on this.

Add this line
File -> Settings -> Compiler -> Gradle -> VM Options:
-Xmx256m

I was failing a class because of this issue. I solved it by
1) Do not delete the Android Studio Version You Downloaded, Leave it intact
2) Google search an older version of Android Studio, in my case, 2.1.1
3) Download it and install, CHOOSE CUSTOM INSTALL
4) A message should appear saying approximately "Another version of Android Studio has been discovered, the installer will only download the missing files"
5) Confirm by starting a new project

I faced the same problem. Had to wait for 30 minutes for the project to built. But then it was working properly again. So maybe waiting is a solution.

Related

Gradle on adroid studio not working properly

Hello there I seriously need a help, I am a python programmer who just have started learning flutter, I have been sitting on one single error for 12 hours now.
I have tried every possible solution on the internet. I have re-installed android studio too, tried to fix xml files too. I am attaching the error below and a screenshot of my build.gradle too, please ask for more if need.
I also get this issue and in my case I found two solutions. First, rebuild the project or you can also try clean project. Second if your project is not big, you creat another fresh project and copy all codes from previous project to this new one and third but not in the list, go to settings and search gradle and then select the latest version of gradle or download it after finishing it restart the android studio with "run as administrator ". Hope it will works.

Gradle sync failed with reason unknown - Android studio 4.2.1 [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
This post was edited and submitted for review 9 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
Did something to trigger a gradle sync (e.g. added a module that has its own compileSdkVersion different from my project's, as seen in its own build.gradle file), but after seeing Gradle sync started in the Event Log, I quickly run into:
Gradle sync failed: Sync failed: reason unknown
Tried solutions
Invalidate cache and restart
reinstalled android studio and recloned project
changed the gradle version
removed .gradle and .idea folder
run gradle build from cli
toggling offline mode
Manually pointed gradle files
[using Android studio 4.2.1 and gradle 6.5, but can encounter this problem with other IDE/gradle combinations, as the problem most likely stems from the dependencies I've changed.]
In your screenshot, there is a infomation bar on top of the editor area "Gradle project sync failed. Basic funtionality will not work." Click the "Show log in finder", you can check the real reason in the log file.
In my case, I found “ Module: 'xxxxx' platform 'android-26' not found” which mean the platform 26 is missing. After download the platform api level 26, problem solved.
There is great post here: https://www.tehrir.com/gradle-sync-failed in this matter.
Make sure your Android Gradle Plugin version matches Gradle version according to this page: https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
If it matches and still gives same error try upgrading to a higher "tier":
4.2.1 and 6.7.1
It worked for me.
I got a similar issue in the new Arctic Fox version. After looking at the idea.log (it should be at /Users/username/Library/Logs/Google/AndroidStudioXX.XX/idea.log), it looked like I was missing some Android SDKs that are needed for the external libraries (I'm working on react native).
Just look for the lines that say Module: xx platform 'android-yy' not found.
Use the SDK Manager and install the SDK version yy
Invalidate cache and restart
In my case, I had multiple missing SDKs, so it didn't work after restarting; I had to repeat steps 1 to 3 another time.
When installing new environment, go to SDK Manager and install necessary API (ex: from 28 to 33)
Finally go to Gradle of App level and Sync Now again.
Did you install all the SDK packages required on Android Studio?
'Cause I solved installing some SDK packages I didn't install previously.
Check if you have missed them.
For understand when you have done, the Event Log tab reports these messages (look at the img) https://i.stack.imgur.com/ids61.png
I had this same issue and i fixed it in the following steps after trying lots of stuff all in vain.
Check the compileSdkVersion 30 and targetSdkVersion 30 values in your app gradle file.
If the values are say 30, you must make sure that when you click the SDK Manager at the top left corner of your Android studio, you will have this SDK level installed.
Otherwise you can install it. from the dialog box that will have popped up. In my case, my app gradle file from a pull request of my company's code was 30 but since i had just updated android studio i had level 31 only installed.
So instead of going through the hassle of installing SDK level 30 of which i was in a rush to do other stuff, I just switched my values from 30 to 31 in the gradle app files.
And everything worked after gradle sync. Then when i had the time, i would later go back to install level 30 and revert the values.
Hope this helps someone as I had spent some good minutes trying to figure out the error
Tried all the options mentioned above and finally deleted the .gradle folder within the project structure and invalidate caches to restart the intellij, this resolved the issue
If you have a fresh installation of android studio , you should
Install java if not already installed (If you re-installed windows) skip this step otherwise
Menu -> Invalidate caches/restart and try to sync Gradle afterwards (If issue still persists go to step 3)
go to tools->SDK Manager-> and install any missing SDK version (Sync Gradle afterwards) if all the android versions are installed prior to your targeted version and subsequent to your compiled SDK version go search another thread on Stack Overflow! else go to step 4
Accept debugging dialog/keys at your android device if you keep the device connected and are waiting to show up in run configuration (Wait few seconds to let the dialog show up. Go to step 5 if dialog not presented in step 4)
Disconnect the USB cable and reconnect again.
make sure to accept the SDK license in step 4.
Just go to "Run/edit configurations" and scroll down to bottom of the window and here you can see option "Before launch"
Remove whatever already inside the little window.
Then click on (+) icon and select "Gradle-aware Make" and then
type "assembleDebug" and select the first option or that you
need. This will solve your problem.
I also have exact errors and tried all solutions, but I solved this by adding Android Virtual Device.
In my case, I added two virtual devices with minimum API level and Maximum API level of my project. Then Restarting the Android Studio Sync Gradle and solved the problem.
Try this with Stable Network Connection.
I had a fresh installation of Android Studio and started facing this problem. After trying all the various solutions, I found that the SDK Platform was not installed for API Level 30, but was installed for API Level 31, and my project was using API Level 30.
So I installed API level 30 SDK Platform and the issue got resolved.

cannot acces 'android.app.Activity' which is a supertype of

I have just installed android studio and i'm trying to create my first application. As soon as i create the project i get this error. Obviously i did not write any code and all the lines you see are the default code of the project.
I tried to sync but, as you see in the terminal below, a license error appears.
How can i fix this problem?
I have installed android studio correctly, installing SDK, tools and so on.
Thank you in advance.
Following the advice of Peppe L-G (the guy who commented my question) i went to sdk manager and in the section "SDK platforms" i installed "Android 10.0(Q)" (API level 29).
Now everything works correctly.
I think when your internet connection was off-line. Because Gradle couldn't reach the library, it thought that was missing.Please check that .when you connected to internet and reopen /reinstalling fix the issue
else check your gradle version android version etc to fix the issue
Option 1:
File -> Sync Project with Gradle Files
Option 2:
File -> Invalidate Cache & Restart

Unable to clean or rebuild project in Android Studio 2

I have a problem with my Android studio 2. That's whenever I want to clean or rebuild my android project, I always get this message
Error:Execution failed for task ':app:clean'.
Unable to delete directory: C:\Users\MyPC\Desktop\SharePlace\app\build\intermediates
and can not fix it. what I only can do is go to File explorer and delete it.
then come back android studio and rebuild again. Sometime, that way also does not work.
I need some help to fix that Android studio. Please.
Thank inadvance!
Solution 1 :
you are using Android Studio 2.0 Beta, this issue might appear (more likely if you are working on NTFS filesystem) and it seems like the "Instant Run" is the culprit. Search for "Instant Run" in settings and uncheck the box.
I have filed an issue on the bug tracker.
Solution 2 :
You need to go to the source file directly. Close the studio and go to the path the issue is located at and delete the folder there.
I got a lot of faults like this.
Try to refresh all gradle projects: in Android Studio click on the "Gradle" tab on the right side of the window. When the gradle menu is shown, click on two blue mixed arrows icon. Then wait a moment until gradle completes refreshing and try cleaning or rebuilding again.
For me it was fixed by running Android Studio as administrator.
Manually deleted folder( build\generated and build\intermediates) after closing android studio works for me.
Found the solution. For windows, goto Task Manager and find your Android Studio. Expand it and end task for OpenJDK Platform Binary as depicted below
screenshot.
Then re-run your app in Android Studio again. It should work, and you don't have to restart your Android Studio all the time. More productivity~

android studio rendering timeout

I have a problem with Android Studio. Since this morning I can't edit my layouts through the Design interface. It's stuck on "Initializing Rendering Library" and the IDE freezes. All my layouts were working well yesterday and I haven't changed anything since then.
I have tried to invalidate the cache and restart but without any result.
Try that steps :
1.Update Android SDK and Android Developer Tools.
2.If that will not help, reinstall Android Studio using the newest available version (remember to do a backup of your data and projects).
3.If that will not help, install other IDE for example Eclipse and import all your projects to it.
Good luck !
For me helped such steps:
Remove .gradle folder from the project folder, all *.iml files and
.idea
Remove C:\Users\username.AndroidStudioPreview1.2
Run Android Studio without importing settings. This will allow to see a dialog where you can open your project from scratch. If you
import settings then Android Studio will open previously opened
*.xml files which caused the problem (hanging "Initializing Rendering Library") and the situation will happen again
Run Gradle cleanup
Sync project
Invalidate cache and Restart
Build the project from command line. If use Build from AndroidStudio I got hanging "scanning files to index..."
I reinstalled my android studio without success,
Then, I downloaded the sdk again, and change my old sdk-path to the new one
After I restarted my studio, it works.
The most mysterious thing is, I rechange my sdk-path back to my older one, then every thing is ok,I don't know why,but it solved the problem

Categories

Resources