Android-Studio is unusable with ArrayOutOfBounds exceptions while USB debugging - android-studio

I am having a very hard time installing a usable Android Studio on Opensuse 13.2.
I have tried Java OpenSDK 1.7.0_75-b13 and 1.8.0_40-b10 as well as the Oracle 1.8.0_31-b13 (setting STUDIO_JDK environment variable and checking File->Other Settings->Default Project Structure). I have installed Android Studio from scratch from the Android developer site. I have installed a brand new SDK in ~/Android/Sdk. I have deleted the old ~/.AndroidStudio directory to try to wipe out any previous configuration, but this has not helped.
The interface is unusable when opening a project because there are constantly ArrayOutOfBounds exceptions being thrown. These are in the Android Studio core, not code that I have written. The following screenshots illustrate the errors.
This occurs when an Android device is connected via USB for debugging.
-29359205: -29359205
java.lang.ArrayIndexOutOfBoundsException: -29359205
at sun.font.FileFontStrike.getCachedGlyphPtr(FileFontStrike.java:472)
at sun.font.FileFontStrike.getSlot0GlyphImagePtrs(FileFontStrike.java:438)
at sun.font.CompositeStrike.getGlyphImagePtrs(CompositeStrike.java:115)
at sun.font.GlyphList.mapChars(GlyphList.java:272)
at sun.font.GlyphList.setFromString(GlyphList.java:244)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:71)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2928)
at com.intellij.openapi.editor.impl.EditorImpl.drawChars(EditorImpl.java:3426)
at com.intellij.openapi.editor.impl.EditorImpl.access$5000(EditorImpl.java:132)
at com.intellij.openapi.editor.impl.EditorImpl$CachedFontContent.flushContent(EditorImpl.java:2948)
at com.intellij.openapi.editor.impl.EditorImpl$CachedFontContent.access$5100(EditorImpl.java:2914)
at com.intellij.openapi.editor.impl.EditorImpl.flushCachedChars(EditorImpl.java:2989)
at com.intellij.openapi.editor.impl.EditorImpl.paintText(EditorImpl.java:2865)
at com.intellij.openapi.editor.impl.EditorImpl.paint(EditorImpl.java:1986)
at com.intellij.openapi.editor.impl.EditorComponentImpl.paintComponent(EditorComponentImpl.java:153)
at javax.swing.JComponent.paint(JComponent.java:1056)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JViewport.paint(JViewport.java:728)
at com.intellij.ui.components.JBViewport.paint(JBViewport.java:119)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5219)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1572)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1495)
at javax.swing.RepaintManager.paint(RepaintManager.java:1265)
at javax.swing.JComponent._paintImmediately(JComponent.java:5167)
at javax.swing.JComponent.paintImmediately(JComponent.java:4978)
at javax.swing.RepaintManager$4.run(RepaintManager.java:824)
at javax.swing.RepaintManager$4.run(RepaintManager.java:807)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:807)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:782)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:731)
at javax.swing.RepaintManager.access$1300(RepaintManager.java:64)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1720)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:702)
at java.awt.EventQueue$3.run(EventQueue.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:524)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
What gives? What do I have to fix to get a usable Android studio?
It appears this may be an Opensuse issue.
There is also a Java OpenStreetMap bug with workarounds that have not worked for me.

Opensuse bug indicates the OpenJDK font problem is triggered when the texlive-arphic-fonts package is installed. Removing it was a workaround for me.

Related

ADB fails only for Flutter but not for Android in Android Studio?

It is very sttrange, but in Android Studio on my Mate Ubuntu 18.04, AMD processor when I create 'Android Project' ADB works well. But once I am creating 'Flutter' one, i have error Error initializing ADB: Android Debug Bridge not found.
I tried start it on Android Studio 3.2, 3.2.1...
I tried recipes from here - no way.
I tried to downgrade ADB to 23.0.1 too as mentioned here.
Here is Log:
ADB not found
java.lang.Throwable: ADB not found
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:126)
at com.android.tools.idea.explorer.adbimpl.AdbDeviceFileSystemService.start(AdbDeviceFileSystemService.java:107)
at com.android.tools.idea.explorer.DeviceExplorerController.setup(DeviceExplorerController.java:139)
at com.android.tools.idea.explorer.DeviceExplorerToolWindowFactory.createToolWindowContent(DeviceExplorerToolWindowFactory.java:51)
at com.intellij.openapi.wm.impl.ToolWindowImpl.ensureContentInitialized(ToolWindowImpl.java:571)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.lambda$initToolWindow$10(ToolWindowManagerImpl.java:510)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindow(ToolWindowManagerImpl.java:513)
at com.intellij.facet.impl.ui.FacetDependentToolWindowManager.ensureToolWindowExists(FacetDependentToolWindowManager.java:93)
at com.intellij.facet.impl.ui.FacetDependentToolWindowManager.projectOpened(FacetDependentToolWindowManager.java:81)
at com.intellij.openapi.project.impl.ProjectManagerImpl.fireProjectOpened(ProjectManagerImpl.java:775)
at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$null$6(ProjectManagerImpl.java:391)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransactionAndWait$2(TransactionGuardImpl.java:165)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:905)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:215)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:201)
at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:579)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:109)
at com.intellij.openapi.progress.impl.CoreProgressManager.runSynchronously(CoreProgressManager.java:318)
at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:303)
at com.intellij.openapi.progress.ProgressManager.run(ProgressManager.java:192)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:483)
at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:191)
at com.intellij.ide.RecentProjectsManagerImpl.doOpenProject(RecentProjectsManagerImpl.java:63)
at com.intellij.ide.RecentProjectsManagerBase.doReopenLastProject(RecentProjectsManagerBase.java:677)
at com.intellij.ide.RecentProjectsManagerBase$MyAppLifecycleListener.appStarting(RecentProjectsManagerBase.java:719)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:426)
at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:387)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:376)
at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:357)
at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:43)
at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:208)
at com.sun.proxy.$Proxy79.appStarting(Unknown Source)
at com.intellij.idea.IdeaApplication$IdeStarter.lambda$main$1(IdeaApplication.java:379)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:377)
at com.intellij.idea.IdeaApplication.lambda$run$0(IdeaApplication.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:208)
at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:49)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:380)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
That problem makes me slow down alot. Like you #Valery Kulikov , I tried those links u mentioned and many others. Finally, I found the solution in Chinese website https://blog.csdn.net/net_wolf/article/details/88971642 but that don't solve the whole. Ok, I will tell u the solution that works for me. In Android Studio, File->Project Structure->Modules->YourProjectName_android->Dependencies->Module SDK: (select API as your Android Emulator) and click Apply and OK. Then, restart Android Studio. I hope it helps you too.
I ran into a similar issue when I fresh installed Flutter SDK and following steps helped me out.
Go to platform-tools folder in your Android SDK, make sure adb files aren't nested into another folder. If nested, move all files to top platform-tools folder. Platform-tool folder shouldn't be nested and it should have adb inside it
Install SDK tools from your SDK manager (if hidden, uncheck Hide Obsolete Packages)
Execute flutter doctor --android-licenses and accept the licenses
Execute flutter doctor -v, it should show [✓] in Android ToolChain

java.lang.AbstractMethodError when trying to run Android Studio

I updated my Android Studio, and ever since I get:
Internal Error. Please report to https://code.google.com/p/android/issues
java.lang.AbstractMethodError: org.jetbrains.settingsRepository.IcsApplicationLoadListener.beforeApplicationLoaded(Lcom/intellij/openapi/application/Application;)V
at com.intellij.openapi.application.impl.ApplicationImpl.fireBeforeApplicationLoaded(ApplicationImpl.java:539)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:491)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:481)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:170)
at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:52)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:362)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
when trying to run Android Studio. When I Google the error:
java.lang.AbstractMethodError: org.jetbrains.settingsRepository.IcsApplicationLoadListener.beforeApplicationLoaded(Lcom/intellij/openapi/application/Application;)
I get only one result of the same problem, but was asked 2 weeks ago and wasn't answered.
I tried re-installing SDK, re-installing Android Studio and no success.
You need to remove the Settings Repository plugin from the Android Studio plugins directory using an external file manager. (The directory depends on your OS, which you didn't specify in your question.)

Issue when launching DevCenter on Windows 8.1.

I cannot launch DevCenter as I am getting the following error message when I try to launch DevCenter.exe on my laptop running Windows 8.1 .
!ENTRY org.eclipse.osgi 4 0 2015-10-22 19:45:14.680
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.datastax.devcenter.rcp.application" could not be found in the registry. The applications available are: org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger, org.eclipse.emf.codegen.ecore.Generator, org.eclipse.emf.mwe.core.WorkflowRunner, org.eclipse.equinox.app.error, org.eclipse.jdt.core.JavaCodeFormatter, org.eclipse.jdt.core.JavaIndexer.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
When I launched it from a desktop computer (Windows 7), it worked fine. But, I'm trying to make it work on my laptop, but couldn't manage to do it so far. Any ideas on how to solve this ?
One thing to check is if your Windows 32-bit or 64-bit and that your Java version is the same 32/64-bit version? Looking at the error message it looks like a 64-bit version of DevCenter. Please verify that both Windows and Java are also 64bit.
Was this a new install or an upgrade? Be careful not to extract archive files into any existing DevCenter folder as this will result in a mix of old and new files. Download and extract a fresh copy to be certain.
I've also read about pre-release versions of Windows causing similar looking errors because they did not properly identify their os version and the eclipse osgi layer (equinox) is unable to resolve dependencies.

NullPointerExcepton in Android Studio plugin Android Support

I am getting the following exception in Android Studio plugin Android Support.
To get out of this error, I updated the Android Studio to 14.1, but studio just builds the app but not runs it.
null
java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1616)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1577)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:350)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:373)
at org.jetbrains.android.facet.AndroidFacet.getAvdManager(AndroidFacet.java:585)
at org.jetbrains.android.facet.AndroidFacet.getAvdManagerSilently(AndroidFacet.java:571)
at org.jetbrains.android.run.DeviceChooser.<init>(DeviceChooser.java:143)
at org.jetbrains.android.run.ExtendedDeviceChooserDialog.<init>(ExtendedDeviceChooserDialog.java:80)
at org.jetbrains.android.run.AndroidRunningState.execute(AndroidRunningState.java:263)
at com.intellij.execution.runners.DefaultProgramRunner.doExecute(DefaultProgramRunner.java:38)
at org.jetbrains.android.run.AndroidDebugRunner.doExec(AndroidDebugRunner.java:144)
at org.jetbrains.android.run.AndroidDebugRunner.doExecute(AndroidDebugRunner.java:135)
at com.intellij.execution.runners.GenericProgramRunner$1.execute(GenericProgramRunner.java:48)
at com.intellij.execution.impl.ExecutionManagerImpl$2.run(ExecutionManagerImpl.java:208)
at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:95)
at com.intellij.execution.impl.ExecutionManagerImpl$1$1.run(ExecutionManagerImpl.java:172)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:524)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I Slove it by this step
you should delete this file that you can do it .
go to the path :"C:\Users\Administrator.android\avd"
and delete all the avd folders files .
try again ,you can get it.
Why this happens
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1616)
The error seems to be in Android SDK library Android Virtual Device Manager. It tries to open a file, and some argument in File constructor is null.
Solution:
I installed the needed plugins again..and it works
What else can be done in similar situations:
Plugin damaged -> reinstall the plugin.
SDK damaged -> reinstall Android SDK.
Wrong version used -> check the used version or update Android SDK.
It seems to be due to virtual devices that are already created are causing problems.
How I solved this issue:
Delete all folders from C:\Users\<userName>\.android\avd
Recreate virtual device from avd manager
It can be solved by editing build.gradle file and synch your project again.
I edited following line
classpath 'com.android.tools.build:gradle:2.3.3' and it worked.
I solved this error by opening the AVD Manager in Android Studio and uninstalling and reinstalling my emulators.

Android studio, configure gradle project takes forever

After changing the gradle build file to use gradle build tool 0.8.+,
classpath 'com.android.tools.build:gradle:0.8.+'
my Android studio is stuck forever at "refreshing X Gradle project". I tried to restart AS, didn't work. I did even change gradle build tool back to 0.7.+, even downgrade my AS from 0.4.4 back to 0.4.2, still no hopes. Anyone experienced this before? pls help
Tks.
Update: now I tried deleting all old .iml files and .idea folder, and reimported, now it's stuck at "Building X Gradle project info", seems like forever.
Building from commandline is perfectly fine.
Update 2: Log file included as requested (.AndroidStudioPreview\system\log\idea.log)
2014-02-17 00:45:27,412 [ 46868] WARN - #org.jetbrains.idea.maven - Failed to update Maven indices for: [http://download.crashlytics.com/maven] http://download.crashlytics.com/maven
org.jetbrains.idea.maven.server.MavenServerIndexerException: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl.updateIndex(Maven3ServerIndexerImpl.java:210)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at $Proxy99.updateIndex(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:106)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:167)
at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:102)
at $Proxy99.updateIndex(Unknown Source)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper$3.execute(MavenIndexerWrapper.java:110)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:118)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper.updateIndex(MavenIndexerWrapper.java:105)
at org.jetbrains.idea.maven.indices.MavenIndex.updateContext(MavenIndex.java:317)
at org.jetbrains.idea.maven.indices.MavenIndex.updateOrRepair(MavenIndex.java:276)
at org.jetbrains.idea.maven.indices.MavenIndices.updateOrRepair(MavenIndices.java:126)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.doUpdateIndices(MavenIndicesManager.java:260)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.access$200(MavenIndicesManager.java:49)
at org.jetbrains.idea.maven.indices.MavenIndicesManager$3.run(MavenIndicesManager.java:231)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl$2.run(Maven3ServerIndexerImpl.java:193)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.executeWithMavenSession(Maven3ServerEmbedderImpl.java:314)
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl.updateIndex(Maven3ServerIndexerImpl.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
at org.jetbrains.idea.maven.server.Maven3ServerIndexFetcher.retrieve(Maven3ServerIndexFetcher.java:108)
at org.sonatype.nexus.index.updater.AbstractResourceFetcher.retrieve(AbstractResourceFetcher.java:22)
at org.sonatype.nexus.index.updater.DefaultIndexUpdater.downloadIndexProperties(DefaultIndexUpdater.java:484)
at org.sonatype.nexus.index.updater.DefaultIndexUpdater.access$100(DefaultIndexUpdater.java:65)
at org.sonatype.nexus.index.updater.DefaultIndexUpdater$IndexAdaptor.setProperties(DefaultIndexUpdater.java:771)
at org.sonatype.nexus.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:945)
at org.sonatype.nexus.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:150)
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl$2.run(Maven3ServerIndexerImpl.java:190)
... 17 more
Caused by: java.lang.RuntimeException: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to locate resource in repository
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:139)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.jetbrains.idea.maven.server.Maven3ServerIndexFetcher.retrieve(Maven3ServerIndexFetcher.java:100)
... 24 more
Caused by: java.io.FileNotFoundException: http://download.crashlytics.com/maven/.index/nexus-maven-repository-index.properties
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1664)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1662)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1660)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1243)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:122)
... 28 more
Caused by: java.io.FileNotFoundException: http://download.crashlytics.com/maven/.index/nexus-maven-repository-index.properties
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1613)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
... 28 more
2014-02-17 00:45:56,749 [ 76205] INFO - TestNG Runner - Create TestNG Template Configuration
2014-02-17 00:45:56,750 [ 76206] INFO - TestNG Runner - Create TestNG Template Configuration
2014-02-17 00:45:56,756 [ 76212] INFO - ellij.project.impl.ProjectImpl - 25 project components initialized in 20 ms
2014-02-17 00:45:56,757 [ 76213] INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2014-02-17 00:47:30,887 [ 170343] INFO - .project.GradleProjectResolver - Gradle project resolve error
org.gradle.tooling.GradleConnectionException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:43)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:170)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$000(GradleProjectResolver.java:61)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$1.fun(GradleProjectResolver.java:117)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$1.fun(GradleProjectResolver.java:113)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:182)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:113)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:61)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:471)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$2.run(ExternalSystemUtil.java:549)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)
Caused by: java.nio.channels.OverlappingFileLockException
at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1017)
at org.gradle.cache.internal.filelock.LockStateAccess.tryLock(LockStateAccess.java:83)
at org.gradle.cache.internal.filelock.LockFileAccess.tryLockState(LockFileAccess.java:83)
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.lockStateRegion(DefaultFileLockManager.java:317)
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.lock(DefaultFileLockManager.java:260)
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.<init>(DefaultFileLockManager.java:132)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:87)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:74)
at org.gradle.cache.internal.OnDemandFileAccess.readFile(OnDemandFileAccess.java:36)
at org.gradle.cache.internal.SimpleStateCache.get(SimpleStateCache.java:40)
at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.get(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:31)
at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.getAll(PersistentDaemonRegistry.java:62)
at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.getIdle(PersistentDaemonRegistry.java:77)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:67)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:149)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:74)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:42)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:30)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:106)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:100)
at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:143)
at org.gradle.tooling.internal.consumer.connection.ActionAwareConsumerConnection.run(ActionAwareConsumerConnection.java:40)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter$1.run(DefaultBuildActionExecuter.java:53)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:82)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
2014-02-17 00:47:30,893 [ 170349] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at 'C:/Users/Tung/TripGoify/TripGoify'
org.gradle.tooling.GradleConnectionException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:43)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:170)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$000(GradleProjectResolver.java:61)
at
If you are on Windows check
C:\Users\YOUR_USER\.gradle\wrapper\dists
whether the gradle 1.10-all is installed there or not inside the directory.
Android Studio downloads the whole distribution first time which is around 60 MB so it takes some time.
Check the distributionUrl in gradle/gradle-wrapper.properties and match the same in your dist directory if it is not available studio will download it. Distribution url will look like :
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
change it to whatever already installed will solve the problem.
Note : The directory name in dist and Zip name must same. Directory will be created while trying to download check whether the Zip is installed properly or not.
This could be anything, but in my case, it is due to an invalid HTTP proxy and some libraries can't be downloaded. In Settings-> HTTP Proxy, set to "None".
I solved it
deleting gradle and intellij files
rm -rf .idea/ *.iml .gradle/
reimporting the project on intellij
choosing same jdk for gradle that you use on gradle terminal(makes sense if you use daemon)
and upgrading from gradle 2.4 to 2.13
delete gradle folder in your project folder then reopen it using studio, in choose dialog choose cancel, don't use grade wrapper to download latest version of gradle
If anyone face this sync stuck problem in mac, give this a try.
right click your
android studio.app -> show package -> content -> gradle
and see the gradle version. In that folder, now got to your android studio IDE and open your preference and go to
Build, execution -> build tool - > gradle
check the preference there. verify the path of gradle is as content - > .... and last there will be gradle version, see if that matched the gradle version in the content of androidStudio.app
guess this helps someone.
after long research I finally found the proper solution, just add "ndkVersion 'yourNDKversion'" inside android section in your app level build.gradle and this solves every time
In my case the problem was Genymotion plugin. Once i removed it from studio and restarted. It worked fine. I still don't know how that could happen as i regularly use genymotion with studio in my other machines. You can still run genymotion even if you remove studio plugin by starting emulator from genymotion itself.
I have centos 7 64 bits installed on a virtualbox 5.0.16 virtual machine and gradle version 2.10 with Android Studio 2.0
The log file of gradle is located at $HOME/.gradle/daemon/2.10 Log file: daemon-<some number>.out.log
By inspecting this log file I found out that libz.so.1 was not found by aapt.
Despite that command "locate libz.so.1" output was
/usr/lib64/libz.so
/usr/lib64/libz.so.1
/usr/lib64/libz.so.1.2.7
aapt was not able to find it.
In order to solve the issue I had to execute
yum install zlib.i686
Once installed, Gradle started compiling. Good luck!
What worked for me in this regard was , replacing the GRDADLE jar and properties file from the respective project that you may be trying to import .
Build a project fresh or , copy the gradle jar and properties file from the working project
Now , further copy these files and replace with the "Originaly" not working gradle files of the project you are trying to import or the project where gradle build hangs
Bit late , but can be of some help to the future queries .
In my case, I used a multi-project setup and included two separate projects in settings.gradle featuring some overlapping properties. I'm not sure which exact properties caused this, but they were most likely name-related. Basically, instead of throwing an exception ("duplicated [something] detected"), Gradle went into an endless loop. Replacing the duplicated properties helped.
change jdk path to the official ones not that you've downloaded with android studio then start a new project .
That happened to me also (Aug/22 Gradle Version 7.3), after getting a "File write failed C:..." dialog the build stuck at "Configure projects..." forever. I tried everything on this post and some other things that I already knew but none of them work. The only solution I found was cloning the repository and start all over again.
If you're opening a new GitHub project, all you need is a fast internet.

Resources