gpt4 book ai didi

android - IntelliJ 新的 android gradle 插件 (0.14.+)

转载 作者:IT老高 更新时间:2023-10-28 11:10:09 26 4
gpt4 key购买 nike

我正在尝试在 IntelliJ 中使用新的 android gradle 插件,但我似乎无法使用新的 gradle 插件构建我的项目。

我将应用程序的 build.gradle 文件中的依赖项修改为 "classpath 'com.android.tools.build:gradle:0.14.+'",我已将 gradle 更新为 2.1,我已更新我模块中的 build.gradle 文件。

我在 IntelliJ 日志中不断收到此错误:

2014-11-03 16:40:12,864 [ 937413]  ERROR - vice.AndroidProjectDataService - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
2014-11-03 16:40:12,864 [ 937413] ERROR - vice.AndroidProjectDataService - JDK: 1.8.0_05
2014-11-03 16:40:12,864 [ 937413] ERROR - vice.AndroidProjectDataService - VM: Java HotSpot(TM) 64-Bit Server VM
2014-11-03 16:40:12,864 [ 937413] ERROR - vice.AndroidProjectDataService - Vendor: Oracle Corporation
2014-11-03 16:40:12,864 [ 937413] ERROR - vice.AndroidProjectDataService - OS: Windows 8
2014-11-03 16:40:12,864 [ 937413] ERROR - vice.AndroidProjectDataService - Last Action: ShowSettings
2014-11-03 16:40:13,130 [ 937679] INFO - indexing.UnindexedFilesUpdater - Indexable files iterated in 5 ms
2014-11-03 16:40:13,130 [ 937679] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 0 files to update
2014-11-03 16:40:13,130 [ 937679] INFO - indexing.UnindexedFilesUpdater - Unindexed files update done in 0 ms
2014-11-03 16:41:02,813 [ 987362] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:\Program Files\Java\jdk1.8.0_05
2014-11-03 16:41:02,815 [ 987364] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:\Program Files\Java\jdk1.8.0_05
2014-11-03 16:41:02,821 [ 987370] INFO - .project.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [-Pandroid.injected.build.model.only=true, -Pandroid.injected.invoked.from.ide=true, --init-script, C:\Users\ionut.negru\AppData\Local\Temp\ijinit8822454065314970200.gradle]
2014-11-03 16:41:07,002 [ 991551] ERROR - vice.AndroidProjectDataService - Failed to set up Android modules in project 'MyApplication'
org.gradle.tooling.model.UnsupportedMethodException: Unsupported method: SourceProvider.getJniDirectories().
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:33)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:240)
at com.sun.proxy.$Proxy128.getJniDirectories(Unknown Source)
at com.android.tools.idea.gradle.customizer.android.ContentRootModuleCustomizer.addSourceFolder(ContentRootModuleCustomizer.java:170)
at com.android.tools.idea.gradle.customizer.android.ContentRootModuleCustomizer.addSourceFolders(ContentRootModuleCustomizer.java:120)
at com.android.tools.idea.gradle.customizer.android.ContentRootModuleCustomizer.setUpContentEntries(ContentRootModuleCustomizer.java:85)
at com.android.tools.idea.gradle.customizer.android.ContentRootModuleCustomizer.setUpContentEntries(ContentRootModuleCustomizer.java:45)
at com.android.tools.idea.gradle.customizer.AbstractContentRootModuleCustomizer.customizeModule(AbstractContentRootModuleCustomizer.java:56)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.customizeModule(AndroidProjectDataService.java:191)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.access$100(AndroidProjectDataService.java:64)
at com.android.tools.idea.gradle.service.AndroidProjectDataService$1.run(AndroidProjectDataService.java:126)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:168)
at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:118)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:984)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:115)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:124)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:112)
at com.intellij.openapi.command.WriteCommandAction.access$000(WriteCommandAction.java:33)
at com.intellij.openapi.command.WriteCommandAction$1.run(WriteCommandAction.java:80)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:85)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.doImport(AndroidProjectDataService.java:114)
at com.android.tools.idea.gradle.service.AndroidProjectDataService.importData(AndroidProjectDataService.java:97)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:90)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:74)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:98)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:74)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:98)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$MyMultiExternalProjectRefreshCallback$1$1.run(ExternalSystemUtil.java:766)
at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.mergeRootsChangesDuring(ProjectRootManagerImpl.java:329)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$MyMultiExternalProjectRefreshCallback$1.execute(ExternalSystemUtil.java:763)
at com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange.run(DisposeAwareProjectChange.java:36)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil$5$1.run(ExternalSystemApiUtil.java:364)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:984)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil$5.run(ExternalSystemApiUtil.java:361)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
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.e(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)
2014-11-03 16:41:07,002 [ 991551] ERROR - vice.AndroidProjectDataService - IntelliJ IDEA 13.1.5 Build #IU-135.1289
2014-11-03 16:41:07,002 [ 991551] ERROR - vice.AndroidProjectDataService - JDK: 1.8.0_05
2014-11-03 16:41:07,002 [ 991551] ERROR - vice.AndroidProjectDataService - VM: Java HotSpot(TM) 64-Bit Server VM
2014-11-03 16:41:07,002 [ 991551] ERROR - vice.AndroidProjectDataService - Vendor: Oracle Corporation
2014-11-03 16:41:07,003 [ 991552] ERROR - vice.AndroidProjectDataService - OS: Windows 8
2014-11-03 16:41:07,003 [ 991552] ERROR - vice.AndroidProjectDataService - Last Action: ExternalSystem.RefreshAllProjects
2014-11-03 16:41:07,290 [ 991839] INFO - indexing.UnindexedFilesUpdater - Indexable files iterated in 6 ms
2014-11-03 16:41:07,290 [ 991839] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 0 files to update
2014-11-03 16:41:07,290 [ 991839] INFO - indexing.UnindexedFilesUpdater - Unindexed files update done in 0 ms

我做错了什么?或者目前无法在 IntelliJ 上使用新的 android gradle 插件,虽然我读过 IntelliJ 应该具有 Android Studio 的所有功能。

PS:我正在使用 IntelliJ Ultimate 版本,我避免迁移到 Android Studio,因为 Ultimate 版本的某些功能在 Android Studio 中不可用。

[更新]经过更多研究后,我从另一个 SO question 中发现 IntelliJ 跟不上 android gradle 插件。 AS 和 IntelliJ 之间存在一些延迟。更多信息可以在这里找到:What is the Android plugin version included in IntelliJ IDEA?关于@Scott Barta 的回复。

看起来 IntelliJ 13.1.5 仅支持 com.android.tools.build:gradle:0.13.0。也许在几天/几周内,IntelliJ 将从 AS 中提取 android gradle 插件并将其推送到他们的产品中。

最佳答案

这是 UnsupportedMethodException Android Studio 0.8.9 的副本

您需要在 build.gradle 中将 Android Studio 升级到 0.9 或将 android 插件降级到 14 以下

buildscript {
repositories {
mavenCentral()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:0.13.+'
}
}

关于android - IntelliJ 新的 android gradle 插件 (0.14.+),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26716597/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com