ShekarMudaliyar / social_share

Flutter package to share images/videos/text on social media
https://pub.dev/packages/social_share
MIT License
112 stars 191 forks source link

Problem Building in Release Mode #158

Closed SubutaDan closed 2 months ago

SubutaDan commented 2 months ago

I am unable to build my Flutter app. that uses social_share in Release mode. I am getting this message:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':social_share:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/dan/git/kokodoko_flutter_client/build/social_share/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.

When I try to build in Release mode I also get numerous error messages about a Kotlin version incompatibility, for example:

e: /Users/dan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.0.20/7388d355f7cceb002cd387ccb7ab3850e4e0a07f/kotlin-stdlib-2.0.20.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.

I think the two are related, but I don't know for sure.

I have done some googling and tried some recommended fixes and workarounds but have not been able to execute the build in Release mode.

I think this problem may have begun when I upgraded Flutter, but downgrading doesn't seem to resolve the issue.

% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.5 23F79 darwin-arm64, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.92.2)
[✓] Connected device (4 available)            
    ! Error: Browsing on the local area network for iPhone (4). Ensure the device is unlocked and attached with a cable or associated
      with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Anyone else encountering this? Any suggestions for resolving?

Thank you for your help.

akbarpour814 commented 2 months ago

same too

slovnicki commented 2 months ago

Adding this into android/build.gradle solved it for me

subprojects { afterEvaluate { android { compileSdkVersion 34 } } }

(if you have some existing subprojects blocks, make this one be the first)

Here's a comment I found that explained it in more detail: https://github.com/transistorsoft/flutter_background_fetch/issues/369#issuecomment-2288110601

SubutaDan commented 2 months ago

Thank you, slovnicki. After following your suggestion I am able to build my app in release mode.

akbarpour814 commented 2 months ago

slovnicki

Thank you, slovnicki. it's work for me too