Tag Archives: Flutter error

[Solved] Flutter Error: fluwx:compileDebugKotlin

Flutter reports an error fluwx:compileDebugKotlin

Cause Analysis

The reason for this exception found on the Internet is basically that the kotlin version does not conform to the cause, Maybe the kotlin version will also cause this error.
But my error is not due to the kotlin version problem, but due to the conflict of the component cache version pulled down by the pub command, as shown below:
insert picture description here
fluwx-3.9.1 and 3.9.2, delete and yml file Inconsistent versions resolve this exception.

Summary

Component name: There may be two reasons for the exception of compileDebugKotlin:
1. The kotlin version often said on the Internet does not conform to
2. There are different versions of the components in the pub cache and they conflict

[Solved] Flutter Error: No MediaQuery widget ancestor found.

Error reporting is shown in figure

Problem code

import 'package:flutter/material.dart';

void main() {
  runApp(SampleAppPage());
}

class SampleAppPage extends StatefulWidget {
  const SampleAppPage({Key?key}) : super(key: key);

  @override
  _SampleAppPageState createState() => _SampleAppPageState();
}

class _SampleAppPageState extends State<SampleAppPage>
    with SingleTickerProviderStateMixin {
  late AnimationController controller;
  late CurvedAnimation curve;

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      duration: const Duration(milliseconds: 2000),
      vsync: this,
    );
    curve = CurvedAnimation(
      parent: controller,
      curve: Curves.easeIn,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: GestureDetector(
          child: RotationTransition(
            turns: curve,
            child: const FlutterLogo(size: 200.0),
          ),
          onDoubleTap: () {
            if (controller.isCompleted) {
              controller.reverse();
            } else {
              controller.forward();
            }
          },
        ),
      ),
    );
  }
}

Reason: the root component of the fluent interface must be MaterialApp

Code after repair

import 'package:flutter/material.dart';

void main() {
  runApp(SampleApp());
}

class SampleApp extends StatelessWidget {
  // This widget is the root of your application.
  const SampleApp({Key?key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Sample App',
      home: SampleAppPage(),
    );
  }
}

class SampleAppPage extends StatefulWidget {
  const SampleAppPage({Key?key}) : super(key: key);

  @override
  _SampleAppPageState createState() => _SampleAppPageState();
}

class _SampleAppPageState extends State<SampleAppPage>
    with SingleTickerProviderStateMixin {
  late AnimationController controller;
  late CurvedAnimation curve;

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      duration: const Duration(milliseconds: 2000),
      vsync: this,
    );
    curve = CurvedAnimation(
      parent: controller,
      curve: Curves.easeIn,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: GestureDetector(
          child: RotationTransition(
            turns: curve,
            child: const FlutterLogo(size: 200.0),
          ),
          onDoubleTap: () {
            if (controller.isCompleted) {
              controller.reverse();
            } else {
              controller.forward();
            }
          },
        ),
      ),
    );
  }
}

 

Flutter Error: dump failed because resource AndroidManifest.xml not found [How to Solve]

I encountered this problem yesterday. First of all, I went online to inquire about these three solutions

1: Use the command fluent clean (some users report errors and solve them)

2 manually delete all files in the build/APP/APK and build/APP/outputs directories

3. There is also the official command to use fluent create

These three solutions failed to solve my error reporting. Then I suddenly had an idea that my outermost folder was a Chinese name. Sure enough, I solved the error reporting after I changed the Chinese name to the English name. I hope all developers will not encounter such a bug

[Solved] Flutter – AAPT: error: resource android:attr/dialogCornerRadius not found.

Launching lib\main.dart on Nokia X6 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:959: error: resource android:attr/fontVariationSettings not found.
  E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:960: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\hupo3\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c1441429ce2aae0e0bed3ad48db2b49e\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\hupo3\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          - the\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          E:\Flutter Projects\intro_to_flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.xiaobing.introtoflutter \
          -0 \
          apk\
          --output-text-symbols\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\hupo3\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\12aaee80bab0fcaef8511d3958ba785b\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

  E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

  C:\Users\hupo3\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\b1fc0e0ff1348f4d278539eb80ede9d3\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:\Users\hupo3\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\b1fc0e0ff1348f4d278539eb80ede9d3\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.
  Command: C:\Users\hupo3\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c1441429ce2aae0e0bed3ad48db2b49e\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\hupo3\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          - the\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @E:\Flutter Projects\intro_to_flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          E:\Flutter Projects\intro_to_flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.xiaobing.introtoflutter \
          -0 \
          apk\
          --output-text-symbols\
          E:\Flutter Projects\intro_to_flutter\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

* 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 18s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

 

Open android\app\build.gradle

Modify compileSdkVersion and  targetSdkVersion