Comments (15)
Add below code in your project level build.gradle file. This worked for me. Also help me in other modules where same issue occurred.
rootProject.buildDir = '../build'
subprojects {
afterEvaluate {
if (project.plugins.hasPlugin("com.android.application")
|| project.plugins.hasPlugin("com.android.library")) {
if (project.name == "flutter_contacts") {
project.android.compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
from flutter_contacts.
Yes, it fixes the issue and the app now compiles fine on Android. Thanks!
from flutter_contacts.
I have also tried to comment out compileOptions and kotlinOptions in the app/build.gradle, replacing them with the jvmToolchain, but the error is still the same:
kotlin {
jvmToolchain(17)
}
//compileOptions {
// sourceCompatibility JavaVersion.VERSION_17
// targetCompatibility JavaVersion.VERSION_17
//}
//kotlinOptions {
// jvmTarget = '17'
//}
from flutter_contacts.
Having same issues.
Execution failed for task ':flutter_contacts:compileDebugKotlin'.
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
from flutter_contacts.
Having same issues.
Execution failed for task ':flutter_contacts:compileDebugKotlin'.
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
My setup
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.22635.2771], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.5)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.84.2)
[√] Connected device (4 available)
[√] Network resources
dependencies {
classpath 'com.android.tools.build:gradle:8.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.4.0'
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
and multi flavor implemented.
from flutter_contacts.
Nothing at all?
from flutter_contacts.
I fixed this by adding:
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
to the build.gradle file. Please modify your build.gradle file as follows:
group 'co.quis.flutter_contacts'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.9.0'
ext.kotlin_coroutines_version = '1.6.4'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 31
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
if (!project.hasProperty("namespace")) {
namespace 'co.quis.flutter_contacts'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0")
}
from flutter_contacts.
Is this the same as #158 ?
from flutter_contacts.
I have already provided the solution, you simply need to implement it.
Add the following lines to your android/build.gradle:
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
Please refer to my previous message:
I fixed this by adding:
kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) } }
to the build.gradle file. Please modify your build.gradle file as follows:
group 'co.quis.flutter_contacts' version '1.0-SNAPSHOT' buildscript { ext.kotlin_version = '1.9.0' ext.kotlin_coroutines_version = '1.6.4' repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.1.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } rootProject.allprojects { repositories { google() jcenter() mavenCentral() } } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { compileSdkVersion 31 kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) } } if (!project.hasProperty("namespace")) { namespace 'co.quis.flutter_contacts' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { disable 'InvalidPackage' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version" implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0") }
from flutter_contacts.
And yes, this is related to #147 and #158
And it still happens with version 1.1.8
from flutter_contacts.
OH cmon developer!!! we need real fix for this problem, can you please upgrade you package!!
from flutter_contacts.
I have already provided the solution, you simply need to implement it.
Add the following lines to your android/build.gradle:
kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) } }
Please refer to my previous message:
I fixed this by adding:
kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) } }
to the build.gradle file. Please modify your build.gradle file as follows:
group 'co.quis.flutter_contacts' version '1.0-SNAPSHOT' buildscript { ext.kotlin_version = '1.9.0' ext.kotlin_coroutines_version = '1.6.4' repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.1.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } rootProject.allprojects { repositories { google() jcenter() mavenCentral() } } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { compileSdkVersion 31 kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) } } if (!project.hasProperty("namespace")) { namespace 'co.quis.flutter_contacts' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { disable 'InvalidPackage' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version" implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0") }
Is there any negative effect on the project? I mean, is this affecting anything else in the project or breaking something?
from flutter_contacts.
Can you please simply update the build.gradle file with the changes I have shown? It really takes 30 seconds, and fixes the issue.
from flutter_contacts.
Can you please simply update the build.gradle file with the changes I have shown? It really takes 30 seconds, and fixes the issue.
This is what worked for me:
#142 (comment)
from flutter_contacts.
Hi all - thanks for your patience and the recommended solutions.
This should be fixed in version 1.1.9. If it is not, please let me know, and reopen this conversation.
from flutter_contacts.
Related Issues (20)
- Contact With Group not retrieved HOT 1
- Is it possible to test for permission before asking?
- conact.name.first contains the whole contact full name and contact.name.last is always null HOT 6
- everything is null except displayName HOT 3
- Coudn't get Contacts in new phone, however worked fine in old phone HOT 1
- openExternalInsert() causing android app crash HOT 1
- Latest flutter stable version is breaking with this plugin use. Urgently need fix! HOT 13
- on contact add remove or edit non events broadcasting HOT 1
- what about support form macOs? HOT 1
- Null in openExternalPick() Response [Android 13] HOT 6
- Platform Exception for Type Exchange accounts (IOS) HOT 1
- Gives empty list when passing withProperties: true on iOS HOT 1
- Need Guidance on Using Intents Instead of READ_CONTACTS and WRITE_CONTACTS HOT 4
- How to modify the call background of a contact person? Thank you HOT 4
- Possible Bug: When Importing Contacts With Phone Number - No Phone Numbers Appear (On Emulated Device) HOT 5
- Not working on iOS 16 HOT 3
- can we get the country code of the contact as well? HOT 1
- compatibility issues with java 1.8 and java 17 HOT 3
- Execution failed for task ':app:mergeLibDexDebug' HOT 9
- No Activity found to handle Intent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_contacts.