Closed Bug 1120032 Opened 10 years ago Closed 10 years ago

Gradle/IntelliJ configuration broken due to mismatched Android-Gradle plugin versions

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

mhaigh reported a frustrating Gradle experience, which manifested itself as a *seemingly* correct import -- all paths in place -- but no Java sources are recognized.  If you inspect the .iml files, you'll see all sensible source and test directories are missing.

I finally witnessed this and tracked it down locally.  In mobile/android/gradle/build.gradle, we specify the Android-Gradle plugin like so:

buildscript {
    dependencies {
        // IntelliJ 14.0.2 wants 0.14.4; Android Studio wants 1.0.0.
        classpath 'com.android.tools.build:gradle:[0.14.4,1.0.0]'
    }
}

The idea was to take *either* 0.14.4 or 1.0.0.  The issue is that we don't specify the right one, necessarily, in either situation.  I don't know how to determine if we're being invoked with the tooling API from a particular tool in the gradle file.  We may just have to make the user configure themselves.

For now, if you're using Android Studio, replace the line with

        classpath 'com.android.tools.build:gradle:1.0.0'

and if you're using IntelliJ 14.0.2, replace the line with

        classpath 'com.android.tools.build:gradle:0.14.4'

This is an inevitable product of the lag between IntelliJ and Android Studio.  Apparently 14.0.3 EAP already has a fix; it's tracked by [1].  See also [2].

This is a regression from Bug 1098239.

[1] https://youtrack.jetbrains.com/issue/IDEA-134118
[2] http://stackoverflow.com/questions/27460672/how-to-import-android-studio-1-0-project-into-intellij-14-ultimate
https://tbpl.mozilla.org/?tree=Try&rev=58233be80ace
https://tbpl.mozilla.org/?tree=Try&rev=0ea3f00d79f0
https://tbpl.mozilla.org/?tree=Try&rev=8b4d5c438471
https://tbpl.mozilla.org/?tree=Try&rev=a4dd4d824d72
It appears, although I have only one (fallible!) machine to test on, that IntelliJ debugging is broken with

14.0.2/Gradle 2.2.1/Android-Gradle 14.0.4

It works with

{14.0.3EAP,Android Studio 1.0}/Gradle 2.2.2/Android-Gradle 1.0.0

The debugger starts and connects, but does not actually break on breakpoints.
https://hg.mozilla.org/integration/fx-team/rev/f58ee1645b79
https://hg.mozilla.org/mozilla-central/rev/f58ee1645b79
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Component: Build Config → Build Config & IDE Support
Product: Core → Firefox for Android
Target Milestone: mozilla38 → ---
Product: Firefox for Android → Firefox Build System
You need to log in before you can comment on or make changes to this bug.