Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ new android gradle plugin (0.14.+)

I'm trying to use the new android gradle plugin in IntelliJ but I can't seem to build my project using the new gradle plugin.

I modified the dependencies in the application's build.gradle file to "classpath 'com.android.tools.build:gradle:0.14.+'", I have updated the gradle to 2.1 and I have updated the build.gradle file in my module.

I keep getting this error in the IntelliJ logs:

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  

I am doing something wrong ? Or at this moment it isn't possible to use the new android gradle plugin on IntelliJ, althought I've read that IntelliJ should have all the features that Android Studio has.

PS: I'm using IntelliJ Ultimate version and I'm avoiding to move to Android Studio as some features from the Ultimate version won't be available in Android Studio.

[Update] After some more research I found from another SO question that IntelliJ doesn't keep up with android gradle plugin. There is some delay between AS and IntelliJ. More info can be found here: What is the Android plugin version included in IntelliJ IDEA? on @Scott Barta response.

As it seems IntelliJ 13.1.5 supports only com.android.tools.build:gradle:0.13.0. Maybe in a few days/weeks IntelliJ will pull the android gradle plugin from AS and push it into their product.

like image 452
Ionut Negru Avatar asked Nov 03 '14 14:11

Ionut Negru


People also ask

How do I get Gradle plugin in IntelliJ?

If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action. In the dialog that opens, select a directory containing a Gradle project and click OK. IntelliJ IDEA opens and syncs the project in the IDE.

What is the latest Gradle version for Android?

0 (May 2022) Android Gradle plugin 7.2. 0 is a major release that includes a variety of new features and improvements.


2 Answers

This is a duplicate of UnsupportedMethodException Android Studio 0.8.9

You either need to upgrade Android Studio to 0.9 or downgrade the android plugin to lower than 14 in your build.gradle

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.+'   } } 
like image 147
Todorus Avatar answered Oct 21 '22 07:10

Todorus


Just updating dosn't work for me. what worked is update the beta version than udate in the canary channel after updating the beta version

Just click on update then change the channel and the click on oK

like image 34
Netero Avatar answered Oct 21 '22 07:10

Netero