jayeshpansheriya / flutter_native_contact_picker

With this plugin a Flutter app can ask its user to select a contact from his/her address book. The information associated with the contact is returned to the app.
https://pub.dev/packages/flutter_native_contact_picker
BSD 3-Clause "New" or "Revised" License
10 stars 23 forks source link

Build error on Flutter 3.24 #17

Closed khaled-0 closed 1 month ago

khaled-0 commented 2 months ago

I'm on the git master branch

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_native_contact_picker:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/home/khaled/Workspace/AMRServer/Flutter-UserClient/build/flutter_native_contact_picker/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.
khaled-0 commented 2 months ago

This happens due to compileSdk not targeting latest sdk 34 in library. As a workaround do this in android/build.gradle

rootProject.buildDir = '../build'

// FIX for Flutter 3.24
subprojects {
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
}

// Must be before this block
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
khaled-0 commented 2 months ago

Relavent issues are https://github.com/livekit/client-sdk-flutter/issues/569#issuecomment-2275686786

https://stackoverflow.com/questions/78852476/error-launching-flutter-app-after-upgrading-to-sdk-version-3-24/78875418#78875418

Mvhd commented 2 months ago

So still on Flutter version 3.24.1 upgrade with build fail. See error below. Please anyone with a solution? I tried the hack but failed

Running Gradle task 'assembleRelease'...                        

FAILURE: Build failed with an exception.

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

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4s
Running Gradle task 'assembleRelease'...                            4.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1`
khaled-0 commented 1 month ago

So still on Flutter version 3.24.1 upgrade with build fail. See error below. Please anyone with a solution? I tried the hack but failed

Running Gradle task 'assembleRelease'...                        

FAILURE: Build failed with an exception.

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

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4s
Running Gradle task 'assembleRelease'...                            4.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1`

you're probably getting this error in GitHub Action just add the following lines to your workflow

      - name: Setup Java
        uses: actions/setup-java@v4
        with:
          distribution: 'zulu'
          java-version: '17'
          cache: 'gradle'
          check-latest: true

This ensures Java 17 is installed on the system

Mvhd commented 1 month ago

Not in github action but Android Studio

Captured-Heart commented 1 month ago

So still on Flutter version 3.24.1 upgrade with build fail. See error below. Please anyone with a solution? I tried the hack but failed

Running Gradle task 'assembleRelease'...                        

FAILURE: Build failed with an exception.

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

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4s
Running Gradle task 'assembleRelease'...                            4.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1`

I am having the same error, I have looked at the gradle settings of the plugin, it doesn't target compileSdkVersion 34, and so will continue to break. So unfortunate

Mvhd commented 1 month ago

Wha t I did was to copy the code (either from github or .../.pub-cache/hosted/pub.dev/flutter_native_contact_picker-0.0.7 on your computer) and paste on a file I created. Then replace the import. That's all. No more breaking changes

wenchaosong commented 1 month ago

same problem +1

please upgrade the android version, please

jayeshpansheriya commented 1 month ago

@khaled-0 Can you please try with 0.0.8 pre version, its still under development, in android device its work fine.

Lets me know if its work for you.

wenchaosong commented 1 month ago

@khaled-0 Can you please try with 0.0.8 pre version, its still under development, in android device its work fine.

Lets me know if its work for you.

I tried 0.0.8 pre , it is ok

jayeshpansheriya commented 1 month ago

@khaled-0 Can you please try with 0.0.8 pre version, its still under development, in android device its work fine. Lets me know if its work for you.

I tried 0.0.8 pre , it is ok

@khaled-0 @wenchaosong @Mvhd @Captured-Heart i have update pre release plugin for ios as well as, lets me know if you facing any ossue.

Thanks.

Mvhd commented 1 month ago

@jayeshpansheriya, I have implemented the prerelease and it's working perfectly after upgrading to the latest Flutter SDK. Thank you

khaled-0 commented 1 month ago

Thanks, Works 👍. I'm still keeping the issue open for new users. Feel free to close this anytime.