Gradle project sync failed on newly created Android project - android

I created an Android project in Intellij Idea (which I'm using instead of Android Studio because I also need to manage some React code in the project as well). I created a basic Activity which was the default for building the project:
package com.example.mypackage.reacttoastex;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
However, I am getting this error message in Intellij:
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly
If I run Build Project, I am getting this:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find any version that matches com.android.support:appcompat-v7:27.+.
Versions that do not match:
26.0.0-alpha1
25.3.1
25.3.0
25.2.0
25.1.1
+ 31 more
Required by:
project :app
In the logs, I am getting this:
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - IntelliJ IDEA 2017.2.5 Build #IU-172.4343.14
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - JDK: 1.8.0_152-release
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - VM: OpenJDK 64-Bit Server VM
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - Vendor: JetBrains s.r.o
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - OS: Mac OS X
2017-11-14 14:31:38,156 [4841535] ERROR - .intellij.util.io.HttpRequests - Last Action: GotoAction
2017-11-14 14:31:38,434 [4841813] INFO - ea.sdk.wizard.SdkQuickfixUtils - Downloading https://dl.google.com/android/repository/repository2-1.xml
2017-11-14 14:31:38,434 [4841813] ERROR - .intellij.util.io.HttpRequests - Assertion failed: Network shouldn't be accessed in EDT or inside read action
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:168)
at com.intellij.util.io.HttpRequests.process(HttpRequests.java:384)
at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:60)
at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:262)
at com.intellij.util.io.RequestBuilder.saveToFile(RequestBuilder.java:67)
at com.android.tools.idea.sdk.StudioDownloader.downloadFully(StudioDownloader.java:86)
at com.android.tools.idea.sdk.StudioDownloader.downloadFully(StudioDownloader.java:98)
at com.android.tools.idea.sdk.StudioDownloader.downloadAndStream(StudioDownloader.java:54)
at com.android.repository.impl.manager.RemoteRepoLoaderImpl.fetchPackages(RemoteRepoLoaderImpl.java:100)
at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:550)
at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:397)
at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:364)
at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
at com.android.tools.idea.sdk.wizard.SdkQuickfixUtils.createDialog(SdkQuickfixUtils.java:129)
at com.android.tools.idea.sdk.wizard.SdkQuickfixUtils.createDialogForPaths(SdkQuickfixUtils.java:85)
at com.android.tools.idea.gradle.project.sync.hyperlink.InstallRepositoryHyperlink.execute(InstallRepositoryHyperlink.java:41)
at com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink.executeIfClicked(NotificationHyperlink.java:38)
at com.android.tools.idea.gradle.notification.QuickFixNotificationListener.hyperlinkActivated(QuickFixNotificationListener.java:37)
at com.intellij.notification.NotificationListener$Adapter.hyperlinkUpdate(NotificationListener.java:31)
at com.intellij.openapi.externalSystem.service.notification.NotificationData$1.hyperlinkActivated(NotificationData.java:77)
at com.intellij.notification.NotificationListener$Adapter.hyperlinkUpdate(NotificationListener.java:31)
at com.intellij.openapi.externalSystem.service.notification.EditableNotificationMessageElement$MyCellEditor$ActivatedHyperlinkListener.hyperlinkUpdate(EditableNotificationMessageElement.java:186)
at javax.swing.JEditorPane.fireHyperlinkUpdate(JEditorPane.java:342)
at javax.swing.text.html.HTMLEditorKit$LinkController.activateLink(HTMLEditorKit.java:875)
at javax.swing.text.html.HTMLEditorKit$LinkController.mouseClicked(HTMLEditorKit.java:674)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.Component.processMouseEvent(Component.java:6544)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6306)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4897)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
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.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:821)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:645)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
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 could be the cause of this?
Maybe the Android SDK is not seen?

Had this a similar issue today
Resolved it by adding the google maven repo:
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
Not my idea though (I'm brand new to Android development and only a bit familiar with Java), I found the answer here:
https://stackoverflow.com/a/47165271/8036618
Not sure what the cause is, but I'm behind a proxy, so maybe IDEA can't download from its default repo but it can download from the google maven repo?

Related

Exception in plugin AppDynamics Android Agent Installer 1.1.38

I am unable to install the plugin AppDynamics Android Agent Installer from the marketplace of android studio. I'm getting below exception stack trace.
java.lang.NoClassDefFoundError: com/android/tools/idea/gradle/parser/GradleBuildFile
at com.appdynamics.androidstudioplugin.installer.BuildGradleFinder.findBuildGradle(BuildGradleFinder.java:19)
at com.appdynamics.androidstudioplugin.screens.ScreenController.setChosenModule(ScreenController.java:122)
at com.appdynamics.androidstudioplugin.screens.ModulePickerScreen$2.mouseClicked(ModulePickerScreen.java:196)
at java.desktop/java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:278)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
at java.desktop/java.awt.Component.processEvent(Component.java:6419)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5029)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4556)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:971)
at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:906)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:838)
at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:808)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:505)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: com.android.tools.idea.gradle.parser.GradleBuildFile PluginClassLoader[PluginDescriptor(name=AppDynamics Android Agent Installer, id=com.appdynamics.androidstudioplugin, path=C:\Users\Administrator\AppData\Roaming\Google\AndroidStudio4.2\plugins\plugin, version=1.1.38)] com.intellij.ide.plugins.cl.PluginClassLoader#405b4138
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:95)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 42 more
I tried changing Gradle versions but still tucked here.
Here are my project configurations
Android Gradle plugin version : 3.2.1
Gradle version : 4.8.1
Kotin version : 1.3.11
Target & Compatible JDK : Java 8
I also have some screenshots attached.
This is likely due to using a newer version of Android Studio then is supported with the "Android Agent Installer" methodology:
"Android Studio 2.1.0 - 2.9.9, 3.2.1 - 3.9.9 (Not supported: 3.0.0 - 3.2.0, 4.0)" - from https://docs.appdynamics.com/21.9/en/end-user-monitoring/mobile-real-user-monitoring/instrument-android-applications/instrument-an-application-with-the-android-agent-installer
Instead, follow these instructions to build using Gradle with the latest version: https://docs.appdynamics.com/21.9/en/end-user-monitoring/mobile-real-user-monitoring/instrument-android-applications/instrument-an-android-application-manually#InstrumentanAndroidApplicationManually-gradle-android-studio

JetPack: "Gradle sync failed: Already disposed!"

I've been using Android Studio 3.1.x on my Debian 9.0 Stretch desktop for some time now with no problems.
I recently installed Android Studio 3.2 Canary 14 (aka JetPack). Following the Getting Started instructions for JetPack, I create a new project w/Kotlin support, and choose Activity & Fragment+ViewModel.
When I try to sync the newly-created project (i.e. Sync Project with Gradle Files), the sync fails.
Looking in the log, I find that an assertion failed (see below):
2018-05-12 16:44:59,062 [ thread 43] WARN - ea.IdeaSyncPopulateProjectTask - Sync failed: Already disposed!
java.lang.RuntimeException: java.lang.AssertionError: Already disposed!
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:179)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:651)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:656)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeOnEdt(ExternalSystemApiUtil.java:480)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeProjectChangeAction(ExternalSystemApiUtil.java:469)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.dispose(ProjectDataManagerImpl.java:442)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:163)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:221)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:228)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doPopulateProject(IdeaSyncPopulateProjectTask.java:120)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:97)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:39)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:86)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.AssertionError: Already disposed!
at com.intellij.openapi.components.impl.ComponentManagerImpl.disposeComponents(ComponentManagerImpl.java:128)
at com.intellij.openapi.module.impl.ModuleImpl.dispose(ModuleImpl.java:145)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:169)
at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:181)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:140)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
at com.intellij.openapi.module.impl.ModuleManagerImpl$ModuleModelImpl.dispose(ModuleManagerImpl.java:895)
at com.intellij.openapi.externalSystem.service.project.AbstractIdeModifiableModelsProvider.dispose(AbstractIdeModifiableModelsProvider.java:467)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl$3.execute(ProjectDataManagerImpl.java:445)
at com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange.run(DisposeAwareProjectChange.java:36)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$executeProjectChangeAction$6(ExternalSystemApiUtil.java:469)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:156)
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:779)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:720)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:395)
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)
2018-05-12 16:44:59,063 [ thread 43] INFO - e.project.sync.GradleSyncState - Gradle sync failed: Already disposed! (1 s 170 ms)
I've tried reinstalling everything, deleting the .gradle directory, etc; no joy.
There seems to be no mention of this issue online, so I'm guessing it's something specific to my setup (vs. a known issue with JetPack), but I'm not sure where to look or what to do about it.
Can anyone shed some light on this?
Invalidate Caches... / Invalidate Caches and Restart
Cancel first sync
Open a new project
Migrate to a new project

Gradle project sync failed without Messages, worked on command-line

In Android Studio, the sync failed:
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
The command-line gradle installDebug worked. There were no messages in the "Messages" view. In the idea.log, the following NullPointerException appeared:
2018-02-04 14:53:15,233 [ thread 15] WARN - ea.IdeaSyncPopulateProjectTask - Sync failed: null
java.lang.RuntimeException: java.lang.NullPointerException
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:188)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:685)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeOnEdt(ExternalSystemApiUtil.java:469)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeProjectChangeAction(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.dispose(ProjectDataManager.java:401)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:156)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:198)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:204)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doSelectiveImport(IdeaSyncPopulateProjectTask.java:206)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:156)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:51)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:726)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:137)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.intellij.openapi.extensions.Extensions.disposeArea(Extensions.java:168)
at com.intellij.openapi.module.impl.ModuleImpl.dispose(ModuleImpl.java:153)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:151)
at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:163)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:132)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:123)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:119)
at com.intellij.openapi.module.impl.ModuleManagerImpl$ModuleModelImpl.dispose(ModuleManagerImpl.java:836)
at com.intellij.openapi.externalSystem.service.project.AbstractIdeModifiableModelsProvider.dispose(AbstractIdeModifiableModelsProvider.java:421)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager$3.execute(ProjectDataManager.java:404)
at com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange.run(DisposeAwareProjectChange.java:36)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$null$6(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$executeProjectChangeAction$7(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:165)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
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:827)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
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)
2018-02-04 14:53:15,234 [ thread 15] INFO - e.project.sync.GradleSyncState - Gradle sync failed (4s 121ms)
Using Invalidate Caches/Restart and removing the .gradle folder did not help. Why is this? How is it fixed?
After unsetting a local gradle distribution in Settings > Build, Execution, Deployment > Gradle (which was set for debugging this problem), Android Studio offered to update to gradle:3.0.1 from gradle:3.0.0. This fixed it.
Previous steps taken:
add the google() repository to buildscript and allprojects
upgrade the compileSdkVersion, and targetSdkVersion to 27
upgrade all com.android.support libraries to 26.1.0
I was getting similar errors after I upgraded my Android Studio to 3.1.3. I don't remember the exact version I was on before that -- version 2 series.
The reason I was getting these errors was because the Gradle plugin version I was using was too low.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
...
}
Once I updated the version from 2.2.3 to 2.3.3, then Android Studio was able to move on and give me more meaningful error messages such as
Gradle sync failed: Minimum supported Gradle version is 3.3. Current version is 2.14.1. If using the gradle wrapper, try editing the distributionUrl in gradle/wrapper/gradle-wrapper.properties to gradle-3.3-all.zip
From there, it's just a matter of resolving version compatibility issues.
For me, it was a simple solution: I had deleted a module from my project and forgot to delete it from settings.gradle
Maybe this can help somebody

Unsupported method: AndroidProject.getPluginGeneration()

i try to use 1.0.2 ide,because i took over the old program of the app ,and i update to 2.3.3,cause the error ,i dont want to use 1.0.2 IDE.
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'xxxxx'
minSdkVersion 10
targetSdkVersion 20
versionCode 8
versionName '1.7'
}
I try to change buildToolsVersion to 21.0.0 , the problem solved!
finally ,you should check you buildtool version downdoad to 21.0.0 ,and you must to check gradle app buildtoolsversion !
i delay the problem cause i used to use eclispe and the jars are different, so perhaps double check your complesdkversion and build toolversion, you have to check and carefully .
Unsupported method: AndroidProject.getPluginGeneration(). The version
of Gradle you connect to does not support that method. To resolve the
problem you can change/upgrade the target version of Gradle you
connect to. Alternatively, you can ignore this exception and read
other information from the model.
org.gradle.tooling.model.UnsupportedMethodException: Unsupported
method: AndroidProject.getPluginGeneration(). The version of Gradle
you connect to does not support that method. To resolve the problem
you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other
information from the model. at
org.gradle.tooling.model.internal.Exceptions.unsupportedMethod(Exceptions.java:34)
at
org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:342)
at com.sun.proxy.$Proxy145.getPluginGeneration(Unknown Source) at
com.android.tools.idea.fd.gradle.InstantRunGradleUtils.getIrSupportStatus(InstantRunGradleUtils.java:49)
at
com.android.tools.idea.run.AndroidRunConfigurationBase.canInstantRun(AndroidRunConfigurationBase.java:686)
at
com.android.tools.idea.run.AndroidRunConfigurationBase.getState(AndroidRunConfigurationBase.java:420)
at
com.intellij.execution.runners.ExecutionEnvironment.getState(ExecutionEnvironment.java:158)
at
com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:55)
at
com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
at
com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:50)
at
com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
at
com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:121)
at
com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:116)
at
com.intellij.execution.impl.ExecutionManagerImpl.access$400(ExecutionManagerImpl.java:67)
at
com.intellij.execution.impl.ExecutionManagerImpl$7.run(ExecutionManagerImpl.java:516)
at
com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:378) at
com.intellij.util.Alarm$Request.run(Alarm.java:398) at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
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:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
at
com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:658)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
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)
It can occur because AS was checking availability of the Instant Run feature. The fixed is to disable Instant Run:
Windows & Linux:
File -> Settings -> Build, Execution, Deployment -> Instant Run.
Mac:
Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run.

Android Gradle - Assertion Error

When I try to do a Gradle Sync, I get an error that says the following:
21:24:11 AssertionError:
com.android.tools.idea.gradle.project.AndroidGradleProjectComponent#8e8dc05
22:13:53 AssertionError: null
And when I view the error in detail, I get this Stack Trace:
null java.lang.AssertionError at
com.android.tools.idea.gradle.project.PreSyncChecks.attemptToUpdateGradleVersionInWrapper(PreSyncChecks.java:174)
at
com.android.tools.idea.gradle.project.PreSyncChecks.ensureCorrectGradleSettings(PreSyncChecks.java:72)
at
com.android.tools.idea.gradle.project.PreSyncChecks.canSync(PreSyncChecks.java:53)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.doImport(GradleProjectImporter.java:430)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.doRequestSync(GradleProjectImporter.java:219)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.access$000(GradleProjectImporter.java:77)
at
com.android.tools.idea.gradle.project.GradleProjectImporter$2.run(GradleProjectImporter.java:184)
at
com.intellij.ui.AppUIUtil.invokeLaterIfProjectAlive(AppUIUtil.java:77)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.requestProjectSync(GradleProjectImporter.java:191)
at
com.android.tools.idea.gradle.project.GradleProjectImporter.requestProjectSync(GradleProjectImporter.java:166)
at
com.android.tools.idea.gradle.actions.SyncProjectAction.actionPerformed(SyncProjectAction.java:43)
at
com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164)
at
com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:170)
at
com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:133)
at
com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:313)
at java.awt.Component.processEvent(Component.java:6179) at
java.awt.Container.processEvent(Container.java:2084) at
java.awt.Component.dispatchEventImpl(Component.java:4776) at
java.awt.Container.dispatchEventImpl(Container.java:2142) at
java.awt.Component.dispatchEvent(Component.java:4604) at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
at java.awt.Container.dispatchEventImpl(Container.java:2128) at
java.awt.Window.dispatchEventImpl(Window.java:2492) at
java.awt.Component.dispatchEvent(Component.java:4604) at
java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717) at
java.awt.EventQueue.access$400(EventQueue.java:82) at
java.awt.EventQueue$2.run(EventQueue.java:676) at
java.awt.EventQueue$2.run(EventQueue.java:674) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690) at
java.awt.EventQueue$3.run(EventQueue.java:688) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687) at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at
com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:520)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Any idea how I can fix this?
If you're using IntelliJ and Android Gradle plugin greater than 0.14 you might have this error. I filed a bug for that:
https://youtrack.jetbrains.com/issue/IDEA-134118
Star the issue, vote it up and they might take a closer look :)
Change
classpath 'com.android.tools.build:gradle:1.0.0'
to
classpath 'com.android.tools.build:gradle:0.14.4'
in build.gradle file
You probably have a bad gradle version set in your build.gradle.
try changing your gradle build version in your gradle dependencies like below
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}

Categories

Resources