How to import Android Studio (1.0) project into In

2019-06-16 12:14发布

问题:

I have an Android Studio project and I would like to start using Intellij 14 Ultimate to take advantage of some of the cool features it has to offer. When I try to open my project I get a message saying:

Gradle Sync

Version 1.0.0-rc4 of the Android Gradle plug-in requires Gradle null or newer. A local Gradle distribution was not found ....

Click 'OK' to use the Gradle wrapper.

I click ok and it tries to Sync, but fails. Here is what the error console says:

Gradle version 2.2 is required. Current version is 2.1. If using the gradle wrapper, try editing the distributionUrl in ~gradle-wrapper.properties~

I modify the file click "Try Again"

Nothing happens. Here is what is in the log file:

2014-12-13 09:40:23,845 [ 572317]  ERROR - llij.ide.plugins.PluginManager - null 
java.lang.AssertionError
    at com.android.tools.idea.gradle.project.PreSyncChecks.attemptToUpdateGradleVersionInWrapper(PreSyncChecks.java:175)
    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:439)
    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.editors.ProjectSyncStatusNotificationProvider$ProjectImportFailedNotificationPanel$1.run(ProjectSyncStatusNotificationProvider.java:105)
    at com.intellij.ui.EditorNotificationPanel$2.hyperlinkActivated(EditorNotificationPanel.java:95)
    at com.intellij.ui.HyperlinkAdapter.hyperlinkUpdate(HyperlinkAdapter.java:28)
    at com.intellij.ui.HyperlinkLabel.fireHyperlinkEvent(HyperlinkLabel.java:187)
    at com.intellij.ui.HyperlinkLabel.processMouseEvent(HyperlinkLabel.java:120)
    at java.awt.Component.processEvent(Component.java:6281)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4872)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4489)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:708)
    at java.awt.EventQueue$4.run(EventQueue.java:706)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:748)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:573)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - IntelliJ IDEA 14.0.2  Build #IU-139.659.2 
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.7.0_71 
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - VM: Java HotSpot(TM) 64-Bit Server VM 
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - Vendor: Oracle Corporation 
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - OS: Mac OS X 
2014-12-13 09:40:23,846 [ 572318]  ERROR - llij.ide.plugins.PluginManager - Last Action: $Copy 

I've also tried importing the project and get similar results. Any ideas?

回答1:

Idea support pointed me to this:

https://youtrack.jetbrains.com/issue/IDEA-134118

Basically changing my gradle dependency fixed it

//For Android Studio
//classpath 'com.android.tools.build:gradle:1.0.0-rc4'

// For Intellij
classpath 'com.android.tools.build:gradle:0.14.4'

Resync and success!



回答2:

I had the same thing happening to me tonight, however it provided me with a link to download the latest Gradle dependency. I downloaded it and it solved all of my problems, it will probably solve all of your's too!



回答3:

This might be a recent solution, I upgraded to 14.0.3 and it solved the problem.