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: solve issue that sdk can not be compiled on android platform #203

Merged
merged 1 commit into from
Sep 9, 2024
Merged

fix: solve issue that sdk can not be compiled on android platform #203

merged 1 commit into from
Sep 9, 2024

Conversation

0xWOF
Copy link
Contributor

@0xWOF 0xWOF commented Sep 3, 2024

Summary

  1. Flutter app project using Amplitude-Flutter cannot be compiled with flutter bulid apk command on build machine that Flutter 3.24.0 or later is installed.
  2. Cause of problem is Flutter 3.24.0 upgrades AndroidX dependencies that requires compileSdkVersion 31. (Amplitude-Flutter use 28 as compileSdkVersion)
  3. It cannot be fixed with modification on flutter app project only.
  4. It can be fixed with modification on flutter app project and Amplitude-Flutter both. (Set compileSdkVersion to 31 or later)
  5. This pull request set Amplitude-Flutter's compileSdkVersion to 31.

Why?

Flutter app project using Amplitude-Flutter cannot be compiled with flutter bulid apk command on build machine that Flutter 3.24.0 or later is installed.
Because on Flutter 3.24.0, it upgrades AndroidX dependencies that requires compileSdkVersion 31 but Amplitude-Flutter use 28.
To fix this issue Amplitude-Flutter should change compileSdkVersion to 31 or later.
Change compileSdkVersion to 31 or later on flutter app project do not fix the problem.

How to reproduce problem?

Run command below.

flutter upgrade
flutter create test_amplitude --platform android
cd test_amplitude
flutter pub add amplitude_flutter
flutter pub get
flutter build apk

Then below error is occurred

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amplitude_flutter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/{YOUR_PATH}/test_amplitude/build/amplitude_flutter/intermediates/merged_res/release/values/values.xml:206: AAPT: error: resource android:attr/lStar not found.


* 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 16s
Running Gradle task 'assembleRelease'...                           17.4s
Gradle task assembleRelease failed with exit code 1

Cause of problem

Flutter 3.24.0 upgrades AndroidX dependencies that requires compileSdkVersion 31.
Refer comment from Flutter issue flutter/flutter#153281 (comment).

Solution

Update Amplitude-Flutter's compileSdkVersion to 31.

Flutter app project using Amplitude-Flutter cannot be compiled with flutter bulid apk command on build machine that Flutter 3.24.0 or later is installed.
Because on Flutter 3.24.0, it upgrades AndroidX dependencies that requires compileSdkVersion 31 but Amplitude-Flutter use 28.
To fix this issue Amplitude-Flutter should change compileSdkVersion to 31 or later.
@louisdeveseleer
Copy link

I have the same issue descrribed with Futter 3.24.0 and I confirm that applying the fix proposed (amplitude_flutter compileSdkVersion set to 31) fixes the issue.

@Mercy811 Mercy811 merged commit a2b21de into amplitude:main Sep 9, 2024
@0xWOF 0xWOF deleted the fix/android-compile-sdk branch September 9, 2024 16:55
justin-fiedler pushed a commit that referenced this pull request Sep 9, 2024
## [3.16.3](v3.16.2...v3.16.3) (2024-09-09)

### Bug Fixes

* solve issue that sdk can not be compiled on android platform ([#203](#203)) ([a2b21de](a2b21de))
Copy link

github-actions bot commented Sep 9, 2024

🎉 This PR is included in version 3.16.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants