hui-z / image_gallery_saver

flutter中用于保存图片到相册的Plugin
MIT License
271 stars 346 forks source link

Running example on android device leads to an error #276

Open quoc-huynh-cosee opened 9 months ago

quoc-huynh-cosee commented 9 months ago

Running the example on android leads to the following error. This is due that the package fluttertoast uses minSdk 21.

/Users/huynh/StudioProjects/image_gallery_saver/example/android/app/src/main/AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:fluttertoast] /Users/huynh/StudioProjects/image_gallery_saver/example/build/fluttertoast/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 19
    Suggestion: use a compatible library with a minSdk of at most 19,
        or increase this project's minSdk version to at least 21,
        or use tools:overrideLibrary="io.github.ponnamkarthik.toast.fluttertoast" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:fluttertoast] /Users/huynh/StudioProjects/image_gallery_saver/example/build/fluttertoast/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 19
    Suggestion: use a compatible library with a minSdk of at most 19,
        or increase this project's minSdk version to at least 21,
        or use tools:overrideLibrary="io.github.ponnamkarthik.toast.fluttertoast" to force usage (may lead to runtime failures)

* 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 2s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
│ The plugin fluttertoast requires a higher Android SDK version.                                │
│ Fix this issue by adding the following to the file                                            │
│ /Users/huynh/StudioProjects/image_gallery_saver/example/android/app/build.gradle:             │
│ android {                                                                                     │
│   defaultConfig {                                                                             │
│     minSdkVersion 21                                                                          │
│   }                                                                                           │
│ }                                                                                             │
│                                                                                               │
│ Following this change, your app will not be available to users running Android SDKs below 21. │
│ Consider searching for a version of this plugin that supports these lower versions of the     │
│ Android SDK instead.                                                                          │
│ For more information, see:                                                                    │
│ https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration          │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1