2017-05-22 57 views
1

我無法運行我的項目,因爲當我嘗試這樣做時出現錯誤消息: Gradle插件從離線Maven回購庫 中缺失,當我看到詳細信息時向我展示了:Gradle插件從離線Maven回購庫中缺失

java.lang.IllegalStateException: Gradle plugin missing from the offline Maven repo 
at com.android.tools.idea.gradle.plugin.AndroidPluginGeneration.getLatestKnownVersion(AndroidPluginGeneration.java:213) 
at com.android.tools.idea.gradle.plugin.AndroidPluginGeneration$1.getLatestKnownVersion(AndroidPluginGeneration.java:68) 
at com.android.tools.idea.gradle.project.sync.setup.post.PluginVersionUpgrade.log(PluginVersionUpgrade.java:64) 
at com.android.tools.idea.gradle.project.sync.setup.post.PluginVersionUpgrade.checkAndPerformUpgrade(PluginVersionUpgrade.java:51) 
at com.android.tools.idea.gradle.project.sync.setup.post.PostSyncProjectSetup.setUpProject(PostSyncProjectSetup.java:163) 
at com.android.tools.idea.gradle.util.Projects.lambda$populate$2(Projects.java:182) 
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2453) 
at com.android.tools.idea.gradle.util.Projects.populate(Projects.java:168) 
at com.android.tools.idea.gradle.util.Projects.populate(Projects.java:120) 
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.lambda$populateProject$1(ProjectSetUpTask.java:120) 
at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$runWhenProjectIsInitialized$5(StartupManagerImpl.java:370) 
at com.intellij.openapi.application.TransactionGuardImpl$6.run(TransactionGuardImpl.java:291) 
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:326) 
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:310) 
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:795) 
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631) 
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387) 
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) 

我該如何解決這個問題?

回答

0

您是否已更新至Android Studio 3.0 Canary 1?

如果是這樣,我也有同樣的問題。他們搬到一些事情,他們的新倉庫:https://maven.google.com

所以我不得不在我的build.gradle文件中gradle這個添加以下代碼

repositories { 
    maven { 
    url "https://maven.google.com" 
    } 
} 

此外,還,我只好maually更新以下依賴:

dependencies { 
    classpath 'com.android.tools.build:gradle:3.0.0-alpha1' 
} 

最後,還需要gradle這個-包裝進行更新:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip 

希望它會幫助

0

我已經通過刪除Android Studio根目錄下的文件夾「gradle」,運行File - > Invalidate Caches/Restart in Android Studio,然後將文件夾「gradle」複製到根目錄來自剛剛下載的相同版本的Android Studio的Android Studio目錄。然後再次重新啓動Android Studio。

我不是聲稱這是一個正確的方法來解決這個問題,但它對我有用 - Android Studio阿爾法和貝塔斯不是穩定的版本。