Firebase-android-sdk: `IidCompatibilityCheckFailure` lint check fails with a null pointer exception (NPE)...

Created on 23 Jun 2020  ยท  26Comments  ยท  Source: firebase/firebase-android-sdk

IidCompatibilityCheckFailure lint check fails with a null pointer exception (NPE)...

Using bom 25.4.1 and Iid 20.2.0

The check failed to run as it encountered unknown failure. This is most likely caused by a new version of Android Gradle Plugin that this check does not support. Please make sure your build does not depend on firebase-iid version earlier than 20.1.1 as it will cause issues.

[REQUIRED] Step 2: Describe your environment

  • Android gradle plugin 4.0.0
  • Firebase Component: bom 25.4.1 and Iid 20.2.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Run lintRelease

Seems to be related to dagger 2.28, or Google places SDK 2.3.0 or androidtimesquare lib 1.7.10

firebase-installations

Most helpful comment

Hi Everyone.

Sorry for the delayed response. Yes, its a broken lint check caused by the reflection call in Firebase-Installations library resulting in this issue. I was figuring out if its safe to remove the lint check from the firebase-installations library.

We have decided on removing the lint check from Firebase Installations library by mid November. Since, this lint check failure is a weak warning, anyone getting this error please feel free to ignore it if your app depends on firebase-iid version i.e greater than 20.1.1

I will keep this issue open till we rollout the lint removal.

Thanks,
Ankita

All 26 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@yogurtearl Thanks for reporting this issue. I am Ankita from the Firebase team.

I used the following setup you mentioned but I couldn't reproduce this issue:

  • Android gradle plugin 4.0.0
  • Firebase Component: bom 25.4.1 and Iid 20.2.0
  • Gradle version: 6.1.1

It's possible that the firebase-installations lint check could fail to run on a newer version of Android Gradle Plugin. But I tested it out with Android gradle plugin 4.0.0 and the check works as expected.

Could help me with more details like

  • Your app android dependency graph? This will help us identify if you are running any incompatible iid version
  • Any other steps that can help me reproduce this issue.

I am using Gradle 6.5

Hi @yogurtearl

Thanks for the Gradle version. I tried running with that version and still dint see the check fail. Are you able to consistently run into lint check failure.

Yes, it is a nullpointerexception, but not sure how to get lint to print the full stack trace.

I started to get the same issue in Android Studio when performing a code inspection.

Gradle: 6.1.1

Firebase dependencies:
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
implementation 'com.google.firebase:firebase-ml-vision-face-model:20.0.1'

image

Thanks for your response @perracolabs & @yogurtearl .

I will try with versions as shown in @perracolabs comment & see if I am able to reproduce the issue.

@perracolabs Which version of Android studio & Android Gradle plugin are using?

@yogurtearl Regarding how to get a full stack trace:

When you run lintRelease it generates a local HTML report with detailed errors. You can try checking if that file has the full stack trace.

@ankitaj224

Gradle version: 6.1.1
Android Studio: 4.0

In case is of any use, the lint warning appears when performing a code inspection at "whole project" level

I've found out that "firebase-ml-vision-face-model:20.0.1" has been deprecated, I removed it as it would had made sense that this could be the issue based in the lint notes about the 20.1.1 minimal version requirement.
But, this issue still happens using only the next 2 dependencies:

    implementation 'com.google.firebase:firebase-analytics:17.4.4'
    implementation 'com.google.firebase:firebase-ml-vision:24.0.3'

PS: Make sure to perform a "whole project" code inspection in order to reproduce the issue. For a moment I thought it was solved after I removed the deprecated library, yet I missed this setting.

I might be seeing the same thing with a more descriptive error with Gradle 6.5.1 and Android Gradle Plugin 4.2.0-alpha04:

Check failed with exception: java.lang.NoSuchMethodException: com.android.tools.lint.detector.api.LintModelModuleProject.getGradleProjectModel()

@petedoyle Thanks for posting the descriptive error. This is super helpful.

I am still unable to reproduce this issue with all the versions mentioned here. I will continue to reproduce this issue, meanwhile if this lint check is blocking you by any chance - you can disable this lint check by adding the following lines in your gradle file.

android {
lintOptions {
disable "IncompatibleIidVersion"
}
}

@ankitaj224

Find attached a simple test project where I can reproduce the issue.
In my case I only need to create a new empty project add a firebase dependency and will get the warning when doing a code inspection set to 'whole project'.

I also include an export of my Android Studio settings, so by importing them you can match a similar development environment, if you also use the same Gradle and Android Studio versions.

Gradle version: 6.1.1
Android Studio: 4.0

in gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip

In the project level build.gradle:
classpath 'com.android.tools.build:gradle:4.0.1'

Test.zip

It's worth noting that this is not a failure it's just a "weak warning" https://github.com/firebase/firebase-android-sdk/blob/3f4b32de9dc483b94c50a1181cb5406e0d4382f5/firebase-installations/customer-lint-checks/src/main/java/com/google/firebase/installations/lint/IncompatibleIidVersionDetector.kt#L117-L121

So arguably it's not a bug that needs fixing, although I could be convinced that we can make it fail silently

cc @ankitaj224

I have the same issue on Gradle 6.1.1 and Android Studio 4.2 Canary 5

I have the same issue in AS 4.0.1, Gradle 6.4, Gradle plugin 4.0.1. No Dagger. FCM was installed a year ago. Didn't sign in Google in the top right corner of AS. After signing in Google Analyze > Inspect Code didn't change the behaviour.
image

Similarly, I just started seeing this after I updated to Gradle Plugin 4.1.0 with Gradle 6.5:

/Volumes/android/android-application/mobile: Information: Check failed with exception: java.lang.NoSuchMethodException: com.android.tools.lint.detector.api.LintModelModuleProject.getGradleProjectModel() [IidCompatibilityCheckFailure]

   Explanation for issues of type "IidCompatibilityCheckFailure":
   The check failed to run as it encountered unknown failure.
   This is most likely caused by a new version of Android Gradle Plugin that
   this check does not support.
   Please make sure your build does not depend on firebase-iid version earlier
   than 20.1.1 as it will cause issues.

Our dependencies show that we're using com.google.firebase:firebase-iid:20.3.0, so we should be over the version mentioned here.

@ankitaj224 You can check this repository to reproduce the error using Android Studio 4.1

Android Studio: 4.1
Gradle: 6.5

I created a new Empty Activity project using Android Studio 4.1. The only code I added after creating the new project was for adding Crashlytics to the project by following the instructions from the official documentation.

This commit (https://github.com/harshalbhakta/IidCompatibilityCheckFailureDemo/commit/927c869315f0bf32fd49bcb00c5b4272250bc232) has the changes I made to enable Crashlytics. Code in this commit causes below lint warnings.

Screenshot 2020-10-17 at 12 23 53 PM

Screenshot 2020-10-17 at 12 23 19 PM

````shell
Check failed with exception: java.lang.NoSuchMethodException: com.android.tools.idea.lint.AndroidLintIdeProject$LintGradleProject.getGradleProjectModel()

Check failed with exception: java.lang.NoSuchMethodException: com.android.tools.idea.lint.common.LintIdeProject$LintModuleProject.getGradleProjectModel()
````

````shell
Firebase IID Compatibility Check Unable To Run

The check failed to run as it encountered unknown failure.
This is most likely caused by a new version of Android Gradle Plugin that this check does not support.
Please make sure your build does not depend on firebase-iid version earlier than 20.1.1 as it will cause issues.

Issue id: IidCompatibilityCheckFailure
````

I'm having this issue too since AGP 4.1, and I could reproduce it with @harshalbhakta project ๐Ÿ‘

Same issue on AGP 4.1, Gradle Version 6.7, iid is 20.3.0.
Note this is a multi module project.

Gradle Version 6.5 and iid is 20.3.0 Android Studio 4.1.0 having the same issue

Hi Everyone.

Sorry for the delayed response. Yes, its a broken lint check caused by the reflection call in Firebase-Installations library resulting in this issue. I was figuring out if its safe to remove the lint check from the firebase-installations library.

We have decided on removing the lint check from Firebase Installations library by mid November. Since, this lint check failure is a weak warning, anyone getting this error please feel free to ignore it if your app depends on firebase-iid version i.e greater than 20.1.1

I will keep this issue open till we rollout the lint removal.

Thanks,
Ankita

disable "IncompatibleIidVersion"

this also doesn't seem to work...I end up adding these to our lint baselines...

@kenyee use disable 'IidCompatibilityCheckFailure'

Was this page helpful?
0 / 5 - 0 ratings