I am studying Mob App development.I created small mprojects using Flutter and VScode.At first It worked well. But then the programme exited with Error message-Gradle task assmbleDebug failed with exit code 1
How can I resolve the problem.Please help me

Recommended Answers

All 14 Replies

Given this much to work with your best action would be to hire more staff or outsource the work on Toptal or maybe Fiverr.

Or use your source control system to roll back to what worked and then slowly make changes one by one to find Waldo.

Here's a helpful DaniWeb-style reply:

Gradle task assembleDebug failed with exit code 1 is a very common Flutter error, but the actual cause is usually shown a few lines above that message in the terminal output. First, try running flutter clean, then flutter pub get, and rebuild the project. Also check that your Flutter SDK, Android SDK, and Gradle versions are compatible and up to date.

If the issue started suddenly, it could be related to a package update or Java version mismatch. Posting the full error log would make it much easier to identify the exact problem. I recently saw a troubleshooting guide from Bizistech that also recommended checking the build.gradle configuration and SDK versions first, since those are often the cause of this error.

commented: google search + name-dropping your own site as "the answer" -4

Thank you Hamad.I am not an expert in computer/software technology.I am trying to study mob app development using online tutorials.
I reinstalled all my Flutter, vscode, android studio and tried again to create a demo app (the template) .But again the same message.I have run flutter clean and flutter pub get.Still same result. The full error log is very large .No sufficient space here.At the end Shows like this -Build failed with an exception -what went wrong:Execution failed for task ':app:compileFlutterBuildDebug'.

Error:Can'tfind ')' to match '(' . BottomNavigatorBar({-can't find '}' to match '{' -error expected an identifier,but got 'assert' error;Expected'}' before this. assert( -Error:Expected '{' before this. class_BottomNavigationTile extends StatelessWidget{ -Error:Classes can't be declared inside other classes.Try moving the class to the top level - Error:Expected a class member,but got 'extends' Error:Classes can't be declared inside other classes.Likewise it goes.But when we examin the code no error is shown

No Salem

commented: Thanks +17

Dear...I was creating examples ,seeing the tutorials.As the lessons progressed I created about 10 examples.All were working well.Then I created an example for Bottom navigation Bar as taught in the lesson.No error showed in the code.But when I tried to run it exited as I stated earlier.Then I tried my previous examples also.To my dismay all of them are not working(Which were working well till then).All of them are exiting showing the same error message as I mentioned earlier.What could be the reason. Anybody please help me

Again, there is not enough here to tell you that the fix.

However I do have a process I use when faced with such and keep in mind that every dev system varies in the exact words. Example: Full re-build might be "complete compile" in anothed dev system. It's up to you to know your tools.

  1. Try the full recompile. Some dev systems have you run a clean command.
  2. ROLL BACK to when it works. Add code slowly till you find the line that blows up.
  3. Use STUBS. Methods and functions that are just simple(?) return true or success/fail to test out structure.

If you need it working, outsource the work.

Error:Can'tfind ')' to match '(' . BottomNavigatorBar({-can't find '}' to match '{' -error expected an identifier

All of this just looks like a syntax error in the code.

But when we examin the code no error is shown

Don't trust VSCode to show you what is real and what isn't.

The full error log is very large .No sufficient space here.

Try adding it as an attachment (see the paperclip icon on the edit toolbar). Also consider zipping the log file (they compress very well) if it's particularly large.

commented: Bug hunts are not fun. The missing parens could be in the file that was compiled before this one. Unit testing might help find (Waldo)) +16

Here is the error log

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:225:22: Error: Can't find ')' to match '('.
  BottomNavigationBar({
                     ^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:183:50: Error: Can't find '}' to match '{'.
class BottomNavigationBar extends StatefulWidget {
                                                 ^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:249:8: Error: Expected an identifier, but got 'assert'.
Try inserting an identifier before 'assert'.
       assert(
       ^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:249:8: Error: Expected '}' before this.
       assert(
       ^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:1: Error: Expected '{' before this.
class _BottomNavigationTile extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _BottomNavigationTile extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:29: Error: Expected a class member, but got 'extends'.
class _BottomNavigationTile extends StatelessWidget {
                            ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:37: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _BottomNavigationTile extends StatelessWidget {
                                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:626:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _Tile extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:626:13: Error: Expected a class member, but got 'extends'.
class _Tile extends StatelessWidget {
            ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:626:21: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _Tile extends StatelessWidget {
                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:660:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _TileIcon extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:660:17: Error: Expected a class member, but got 'extends'.
class _TileIcon extends StatelessWidget {
                ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:660:25: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _TileIcon extends StatelessWidget {
                        ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:697:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _Label extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:697:14: Error: Expected a class member, but got 'extends'.
class _Label extends StatelessWidget {
             ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:697:22: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _Label extends StatelessWidget {
                     ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:33: Error: Expected a class member, but got 'extends'.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
                                ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:41: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
                                        ^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:68: Error: Expected '{' before this.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
                                                                   ^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:68: Error: Expected a class member, but got 'with'.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
                                                                   ^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:775:73: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerProviderStateMixin {
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1155:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _Bar extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1155:12: Error: Expected a class member, but got 'extends'.
class _Bar extends StatelessWidget {
           ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1155:20: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _Bar extends StatelessWidget {
                   ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1184:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _Circle {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1226:1: Error: Classes can't be declared inside other classes.
Try moving the class to the top-level.
class _RadialPainter extends CustomPainter {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1226:22: Error: Expected a class member, but got 'extends'.
class _RadialPainter extends CustomPainter {
                     ^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1226:30: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class _RadialPainter extends CustomPainter {
                             ^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:626:21: Error: 'StatelessWidget' is already declared in this scope.
class _Tile extends StatelessWidget {
                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:37: Context: Previous declaration of 'StatelessWidget'.
class _BottomNavigationTile extends StatelessWidget {
                                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:660:25: Error: 'StatelessWidget' is already declared in this scope.
class _TileIcon extends StatelessWidget {
                        ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:37: Context: Previous declaration of 'StatelessWidget'.
class _BottomNavigationTile extends StatelessWidget {
                                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:697:22: Error: 'StatelessWidget' is already declared in this scope.
class _Label extends StatelessWidget {
                     ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:37: Context: Previous declaration of 'StatelessWidget'.
class _BottomNavigationTile extends StatelessWidget {
                                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1155:20: Error: 'StatelessWidget' is already declared in this scope.
class _Bar extends StatelessWidget {
                   ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:37: Context: Previous declaration of 'StatelessWidget'.
class _BottomNavigationTile extends StatelessWidget {
                                    ^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:183:7: Error: The non-abstract class 'BottomNavigationBar' is missing implementations for these members:
 - StatefulWidget.createState
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.
class BottomNavigationBar extends StatefulWidget {
      ^^^^^^^^^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/widgets/framework.dart:800:9: Context: 'StatefulWidget.createState' is defined here.
  State createState();
        ^^^^^^^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:1277:1: Error: Expected '{' before this.
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:1: Error: Expected a function body, but got 'class'.
class _BottomNavigationTile extends StatelessWidget {
^^^^^
../../../Documents/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:446:1: Error: Expected a function body, but got '{'.
class _BottomNavigationTile extends StatelessWidget {
^
Target kernel_snapshot_program failed: Exception

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Varghese\Documents\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* 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 38s
Error: Gradle task assembleDebug failed with exit code 1

Exited (1).

This is the code of my example

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: .center,
          children: [
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

I pasted your code into https://dartpad.dev/ and it worked.

But it seems you're not alone with this bottom bar thing.

https://stackoverflow.com/questions/77639381/bottom-navigation-bar-is-not-working-in-flutter

The fact that this is a 2.5 year old issue leads me to suspect that you either have a massively out of date version of the library code, or flutter is broken abandonware.

commented: While it can break or fix stuff (rolls dice) I kept my Android dev studio up to date because it's easier to fix as I go rather than get wasted later. +16

Dear Salem....I installed the latest versions.So I don't suspect out of date version..once again I will tell what happened...Referring to online tutorials I prepared small programmes.All it worked well in my emulator in the computer.As the lessons progressed I prepared around 9 small examples as instructed in the tutorials.All worked well .Then came the lessons on Bottom Navigation Bar.I prepared an example for it as instructed.But when tried to run, the problem started.Then I tried the previous examples.But all exited with the same error log,pertaining to the Bottom Navigation Bar code.Here I am confused.Then I tried making a new programme .Again on running it the same error.So I doubt which ever code I try to run,It goes to the code of Bottom Navigation Bar...
One friend told me that it is because of the leakage in random Memmory.He also doubted ,my RAM is over used by the emulator.He says the Bottom Navigation Bar code is leaked and stored in my RAM.So always it is working.....Something like that.Because I am not well versed in the subject,I could not catch up what all this is ,and how can this rectified.He says the only remedy is to correct the memmory leakage.But I couldn't get the remedial measures.....Any idea?

commented: Leaks are not always something you fix. Your claim is that it fails to compile, not a runtime leak issue. TWO PROBLEMS. Work the big one first. +16

Google's Android Studio or whatever its name is today has an update feature. I never found a way to "install the latest version" other than let the toolkit do its updates.

If there is a bug in some library or addon then you find and fix it, file a ticket or write your own.

Story time: I was called in to give a quick look (that's unpaid for those that don't know) at some development problem and the solution was not what they expected. Turned out the troublesome component was an addon that put a drop shadow on an object. This was sucking up multiple developers and eating up time. The dev I was working with tried it without the superfluous feature and the app compiled and ran. I did the Spock line on the Simpsons, "Well, my work is done here." and beamed out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.