Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the crash for projects using JVM 17 #367 #371

Closed
wants to merge 1 commit into from

Conversation

OmarDefaoui
Copy link

Fix the crash for projects using JVM 17 #367

@Zazo032
Copy link
Collaborator

Zazo032 commented Nov 12, 2023

@OmarDefaoui thanks for the fix! Could this also be solved by upgrading ext.kotlin_version (last is 1.9.20) and com.android.tools.build:gradle (last is 8.1.3)?

@Zazo032 Zazo032 added the platform-android Specific to Android platform label Nov 12, 2023
@OmarDefaoui
Copy link
Author

Yes, it will also fix the issue

@vlazdra
Copy link
Contributor

vlazdra commented Nov 20, 2023

Hey @Zazo032 the project is not building if I don't add this inside the android blcok:

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_17
      targetCompatibility JavaVersion.VERSION_17
    }

When I add it, it then works and builds my project.
Note: I've updated the kotlin plugin to 1.9.20 and AGP to 8.1.4 for both my project and the intercom_flutter package.

@deepak786
Copy link
Collaborator

Hey @Zazo032 the project is not building if I don't add this inside the android blcok:

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_17
      targetCompatibility JavaVersion.VERSION_17
    }

When I add it, it then works and builds my project. Note: I've updated the kotlin plugin to 1.9.20 and AGP to 8.1.4 for both my project and the intercom_flutter package.

I don't think that this change should be added in intercom_flutter. It must be added in root project/app who is using the intercom_flutter and updated Kotlin plugin and AGP.

@vlazdra
Copy link
Contributor

vlazdra commented Nov 20, 2023

Hey @deepak786. 👋

If I remove the compileOptions block from the intercom_flutter source code, I get this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':intercom_flutter:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

  Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
  Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation 

But if I add the compile block back, it works.
Maybe I'm doing something wrong? Do you maybe have some idea?

@deepak786
Copy link
Collaborator

Can you try by adding the compile options block in your project build.gradle file itself instead of intercom_flutter?

@vlazdra
Copy link
Contributor

vlazdra commented Nov 20, 2023

I did. I mean, it's there the whole time.
Screenshot 2023-11-20 at 17 09 42

Maybe a wild guess, maybe the under-the-hood intercom android sdk has the 1.8 fixed in their build.gradle? Don't know since it's closed source.

@deepak786
Copy link
Collaborator

@vlazdra Please send a query to Intercom support directly.

Note: Don't mention anything about Flutter. Raise the query considering the Android platform only.

@vlazdra
Copy link
Contributor

vlazdra commented Nov 21, 2023

@deepak786 Will do.

No worries I'm aware that they won't assist for something that they don't support officially.

I did however point out, during a meeting, that they should officially support it since it's a major player in the market and it's just a matter of "bridging the gap". 🙂

@deepak786
Copy link
Collaborator

deepak786 commented Nov 24, 2023

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

This will also solve the issue.
We should update with this.
Firebase packages are also using this e.g https://github.com/firebase/flutterfire/blob/eb9c7874dc7e34afba1c2fd0c02c6d56bd6adfc0/packages/firebase_core/firebase_core/android/build.gradle#L36


kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

Ref: https://github.com/firebase/flutterfire/blob/eb9c7874dc7e34afba1c2fd0c02c6d56bd6adfc0/packages/firebase_core/firebase_core/android/build.gradle#L36

@deepak786
Copy link
Collaborator

I have created another PR #387 to add full support of AGP 8

@deepak786
Copy link
Collaborator

Try intercom_flutter: 8.0.7

@vlazdra
Copy link
Contributor

vlazdra commented Dec 4, 2023

Try intercom_flutter: 8.0.7

@deepak786 Just tried it, and it seams that it's working as expected.

@deepak786 deepak786 closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-android Specific to Android platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants