简体   繁体   中英

Gradle task assembleDebug failed with exit code 1 in flutter upgrade

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

In your

android/app/build.gradle

Change compileSdkVersion to 32

{projectname}/android/app/build.gradle并找到compileSdkVersion并将其更改为32

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM