Ismail Mohamed
Ismail Mohamed

Reputation: 81

Intellij Idea - Android Studio Plugin - Build Failed

from 5 months ago I use Intellij Idea CE to develop an android studio plugin

but

after Android studio latest update

Android Studio Arctic Fox | 2020.3.1
Build #AI-203.7717.56.2031.7583922, built on July 26, 2021

my plugin does not work anymore

I update Intellij Idea CE to match the android studio version, then when I tried to build my plugin again

build failed and show me this error

Execution failed for task ':instrumentCode'.
> Could not resolve all files for configuration ':detachedConfiguration3'.
   > Could not find com.jetbrains.intellij.java:java-compiler-ant-tasks:203.7717.56.2031.7583922.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/jetbrains/intellij/java/java-compiler-ant-tasks/203.7717.56.2031.7583922/java-compiler-ant-tasks-203.7717.56.2031.7583922.pom
       - https://dl.google.com/dl/android/maven2/com/jetbrains/intellij/java/java-compiler-ant-tasks/203.7717.56.2031.7583922/java-compiler-ant-tasks-203.7717.56.2031.7583922.pom
       - https://jcenter.bintray.com/com/jetbrains/intellij/java/java-compiler-ant-tasks/203.7717.56.2031.7583922/java-compiler-ant-tasks-203.7717.56.2031.7583922.pom
 

here is my build.gradle

plugins {
    id 'org.jetbrains.intellij' version '0.6.4'
    id 'org.jetbrains.kotlin.jvm' version '1.5.21'
}

group 'com.myplugin'
version '1.5.7'


repositories {
    mavenCentral()
    google()
    jcenter()
}


apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'

dependencies {
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21'

}


// See https://github.com/JetBrains/gradle-intellij-plugin/

intellij {
    version = '2020.3.3'
    plugins = ['android']
    localPath 'ANDROID STUDIO PATH'
    updateSinceUntilBuild = false
}
compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

How to fix it .??

Upvotes: 1

Views: 1354

Answers (1)

Alexander Zolotov
Alexander Zolotov

Reputation: 714

As gradle-intellij-plugin doesn't support Android Studio natively, it doesn't know what compiler version should be used for local AS SDK, and it tries to compiler with the same version as AS, which does not exist. To fix that, you need to specify a particular compiler version explicitly using instrumenting dsl.

All available versions are listed in intellij maven repository. In your case, I think 203.7717.56 would be just fine.

So the configuration should look like this:

tasks {
  instrumentCode {
    compilerVersion = "203.7707.56"
  }    
}

Upvotes: 7

Related Questions