Flutter - sdk set problem after set compile sdk 30 to 31
@Abdullah Khan @Ashkan Yes i did that if you see my error there are dependencies in it so what i did first set compile sdk 30 then
goto Android-->build.gradle-->Open for Editing in Android Studio --> then a new screen open which look like it open in android studio natively and after go to all app/build.gradle and downgrade all dependencies which show error in it then after that sync project,invalidate cache and restart and then it works normally...
Adnan haider
Updated on January 02, 2023Comments
-
Adnan haider over 1 year
When I am using to set compile SDK 30 in flutter then I got these error
* What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction > One or more issues found when checking AAR metadata values: The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.appcompat:appcompat:1.4.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms3\6a6bfbcf60d09272b0cdf4bed2dc0443\ transformed\appcompat-1.4.0\META-INF\com\android\build\gradle\aar-metadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.appcompat:appcompat-resources:1.4.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms3\8fe9ccdb464c8d3dff16cf232813d78c\ transformed\jetified-appcompat-resources-1.4.0\META-INF\com\ android\build\gradle\aar-metadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.emoji2:emoji2-views-helper:1.0.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms3\aa5ebfefee6d35dee263bd0cd4753256\ transformed\jetified -emoji2-views-helper-1.0.0\META-INF\com\android\build\gradle\ aarmetadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.emoji2:emoji2:1.0.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms- 3\b0e38b05362ae33360070f9b30618d9f\transformed\jetified-emoji21.0.0\METAINF\com\android\build \gradle\aar-metadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.core:core:1.7.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms- 3\028820553fa44b6579541915f81b128d\transformed\core1.7.0\METAINF\com\android\build\gradle\aar -metadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.lifecycle:lifecycle-process:2.4.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms- 3\623708390cd51304eeeb10f79f7ceb8b\transformed\jetified-lifecycle-process-2.4.0\META- INF\com\android\build\gradle\aar-metadata.properties. The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0. AAR metadata file: C:\Users\WasiSoft\.gradle\caches\transforms- 3\77475f45e2af1906c765abcaefbb8c4c\transformed\lifecycle-runtime-2.4.0\META- INF\com\android\build\gradle\aar-metadata.properties.
if I am using SDK 31 then I got this issue
C:\Users\WasiSoft\AndroidStudioProjects\wsms_employee\android\app\src\ main\AndroidManifest.xml Error: android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for `andro id:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.comple.example"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <application tools:replace="android:label" android:name="io.flutter.app.FlutterApplication" android:hardwareAccelerated="true" android:label="WSMS Employee" android:icon="@mipmap/ic_launcher" > <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard| screenSize|smallestScreenSize|locale| layoutDirection|fontScale|screenLayout|density|uiMode" android:launchMode="singleTop" android:showWhenLocked="true" android:exported="true" android:theme="@style/LaunchTheme" android:turnScreenOn="true" android:windowSoftInputMode="adjustResize"> <!-- Specifies an Android theme to apply to this Activity as soon as the Android process has started. This theme is visible to the user while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /> <!-- Displays an Android View that continues showing the launch screen Drawable until Flutter paints its first frame, then this splash screen fades out. A splash screen is useful to avoid any visual gap between the end of Android's launch screen and the painting of Flutter's first frame. --> <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> </manifest>
i tried all possible ways to get rid of this issue i dont know why this happens kindly anuone look into this.also how to set activity when compile sdk 31. which is very difficult in flutter
-
Stefan Galler over 2 yearsHave you tried
flutter clean
? -
Adnan haider over 2 years@StefanGaller everything but still failed.
-
Abdullah Khan over 2 years@Adnanhaider any solution?
-
Ashkan over 2 yearsfound any solution?
-
Adnan haider over 2 years@AbdullahKhan kindly check my answer i hope you found this issue and solve it
-
Adnan haider over 2 years@Ashkan kindly look answer
-
adnan ul haque about 2 yearsI just fixed the same issue ==> stackoverflow.com/a/71146453/13698241
-