0

I got source from Github and I download the zip file, and open with Android Studio(Latest) after that I command Pub Get to download dependencies. I thought when I push build button, it might work like another flutter android apps.

But it shows me a lot of errors and I tried various methods in Stackoverflow and solutions in Google but all of the solutions are not working.

The source that I use is https://github.com/nn1ks/RemoteFiles

Source code is okay because

I tried online IDE because I thought the problem is from IDE Settings, but it also no a problem. It seems that the error is from Gradle Settings or version something. How can I solve this problem?

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Launching lib\main.dart on SM N986N in debug mode...
Running Gradle task 'assembleDebug'...
lib/services/connection.g.dart:9:7: Error: The non-abstract class 'ConnectionAdapter' is missing implementations for these members:
 - TypeAdapter.typeId
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 ConnectionAdapter extends TypeAdapter<Connection> {
      ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/registry/type_adapter.dart:7:11: Context: 'TypeAdapter.typeId' is defined here.
  int get typeId;
          ^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:179:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
        ? context.inheritFromWidgetOfExactType(type) as _Provider<T>
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:180:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
        : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/shared/custom_bottom_sheet.dart:291:30: Error: No named parameter with the name 'shadowThemeOnly'.
    theme: Theme.of(context, shadowThemeOnly: true),
                             ^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
lib/shared/custom_show_dialog.dart:269:36: Error: Method not found: 'ButtonTheme.bar'.
      children.add(new ButtonTheme.bar(
                                   ^^^
lib/shared/custom_show_dialog.dart:635:30: Error: No named parameter with the name 'shadowThemeOnly'.
    theme: Theme.of(context, shadowThemeOnly: true),
                             ^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
lib/pages/home.dart:88:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
      resizeToAvoidBottomPadding: true,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/scaffold.dart:1451:9: Context: Found this candidate, but the arguments don't match.
  const Scaffold({
        ^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 7s
Exception: Gradle task assembleDebug failed with exit code 1

1 Answer 1

2

Try running this -

  1. flutter channel stable
  2. flutter upgrade
  3. flutter clean

To remove this warning

Your Flutter application is created using an older version of the Android embedding

You can add this to AndroidManifest.xml under activity tag.

<meta-data
         android:name="flutterEmbedding"
         android:value="2" />

This should remove the warning.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.