-
dependOnInheritedWidgetOfExactType<_LocalizationsScope>() or dependOnInheritedElement() was called before XXXState.initState() completed.
这个报错的原因是你不能再initState方法中获取一个InheritedWidget
-
NoSuchMethodError (Extension 报错)
可能的错误之一:dart将变量类型识别为dynamic
比如Extension on String,从Map<String,dynamic>中获取一个String执行一个Extension操作,此时会报错,
解决方法:主动声明变量类型
-
红米手机申请权限明明权限提示已经弹出并且确认,但实际并未取得权限
解决方法:确保按照permission_handler最新的操作完成权限申请,然后在
android\app\src\main\AndroidManifest.xml
中添加<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.cute_file"> <uses-permission android:name="android.permission.INTERNET"/> <application android:label="Cute File" android:name="${applicationName}" android:icon="@mipmap/ic_launcher" android:requestLegacyExternalStorage="true" // 添加这句 android:usesCleartextTraffic="true"> <activity
-
在模拟器上运行时报错:
Error launching application on Android SDK built for x86.
解决方法:
1、打开AVD Manager
2、清理数据 wipe data
-
突然报错
Execution failed for task ':wakelock:compileDebugKotlin'.
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
BUILD FAILED in 22s
[!] Your project requires a newer version of the Kotlin Gradle plugin.
Find the latest version on kotlinlang.org/docs/gradle…, then update D:\flutter project\cute_file\android\build.gradle:
ext.kotlin_version = ''
Exception: Gradle task assembleDebug failed with exit code 1
解决方法:按报错信息 更新build.gradle 里面的 ext.kotlin_version
-
启动app时video_thumbnail插件报错
Execution failed for task ':video_thumbnail:compileDebugJavaWithJavac'.
解决方法:把build.gradle里的classpath 'com.android.tools.build:gradle:7.0.2' 更新成了7.0.2 同时需要同步更新gradle-wrapper 里的gradle版本
-
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Unsupported operation: read-only 这里是把sqflite数据库返回的列表直接复制给了变量,然后尝试修改,发生了报错 解决方法:sqflite返回的列表是不可更改的,可以使用List.from(list)赋值给其他变量
-
打包遇到报错:
Execution failed for task ':app:lintVitalRelease'. > Could not resolve all artifacts for configuration ':image_picker_android:debugUnitTestRuntimeClasspath'. > Failed to transform bcprov-jdk15on-1.68.jar (org.bouncycastle:bcprov-jdk15on:1.68) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Execution failed for JetifyTransform: /Users/bob/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar. > Failed to transform '/Users/bob/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.68/46a080368d38b428d237a59458f9bc915222894d/bcprov-jdk15on-1.68.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.) Suggestions: - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there. - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
解决方法:android/gradle.properties 添加
android.jetifier.blacklist=bcprov-jdk15on