Issue
I upgrade my flutter but after that I can't run my code and see the result here is my code. I also wanted to use audio player package but it didn't work for me. changing the version of SDK also didn't work.
import 'package:flutter/material.dart';
void main() => runApp(XylophoneApp());
class XylophoneApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Center(
child:TextButton
(onPressed: (){
},
child:Text('Click Me')),
),
),
),
);
}
}
and here is the error I can't solve
Running "flutter pub get" in tessssssssssssssst...
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
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
> One or more issues found when checking AAR metadata values:
Dependency 'androidx.core:core:1.9.0-alpha05' requires 'compileSdkVersion' to be set to 32 or higher.
Compilation target for module ':app' is 'android-31'
Dependency 'androidx.core:core-ktx:1.9.0-alpha05' requires 'compileSdkVersion' to be set to 32 or higher.
Compilation target for module ':app' is 'android-31'
* 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 54s
Exception: Gradle task assembleDebug failed with exit code 1
Solution
{projectname}/android/app/build.gradle
and find compileSdkVersion
and change it to 32
Answered By - Hardik Mehta
Answer Checked By - Gilberto Lyons (JavaFixing Admin)