Search code examples
flutterpaypalflutter-dependenciespaypal-rest-sdk

Build Failed after adding the flutter_paypal SDK?


After adding the flutter_paypal SDK to my project, when I run the app, I am getting the following error:

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to D:\MyApplication\Application\application\android\app\build.gradle:
android {
  compileSdkVersion 32
  ...
}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (32) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-31).
     Dependency: androidx.webkit:webkit:1.5.0.
     AAR metadata file: C:\Users\MyPc\.gradle\caches\transforms-2\files-2.1\1e17c3cecd51956dd096ba6a3522bf2f\webkit-1.5.0\META-INF\com\android\build\gradle\aar-metadata.properties.

I updated the compileSdkVersion flutter.compileSdkVersion to compileSdkVersion 32 in build.gradle and run the app which then gives the following error:

D:\MyApplication\Application\application\android\app\src\debug\AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:webview_flutter_android] D:\MyApplication\Application\application\build\webview_flutter_android\intermediates\library_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16
    Suggestion: use a compatible library with a minSdk of at most 16,
        or increase this project's minSdk version to at least 19,
        or use tools:overrideLibrary="io.flutter.plugins.webviewflutter" to force usage (may lead to runtime failures)

My Manifest.xml file has no such entry uses-sdk:minSdkVersion then why are these errors? And how to resolve them?


Solution

  • android/app/build.gradle

    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 16 //This place will be 19 or higher
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }