Flutter 报错集合

2,487 阅读1分钟

问题一:

PlatformException (PlatformException(error, Unable to find explicit activity class {com.wodeer.xth2_mobile/com.yalantis.ucrop.UCropActivity}; have you declared this activity in your AndroidManifest.xml?, null))

解决办法:

  • 在android/app/src/main/AndroidManifest.xml中添加
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

问题二 vscode 调试 flutter debug 总是 Lost connection to device

解决办法:

  • brew upgrade --fetch-HEAD usbmuxd
  • 注:电脑硬盘不足也会报错

问题三 flutter键盘弹起布局报错问题

解决办法:

在原有的组件外面包一层SingleChildScrollView

ingleChildScrollView(
	Container()
)

问题四 flutter打包apk是报:Execution failed for task ':app:compileReleaseKotlin'.

解决办法:

使用Android studio打开项目,选择File => Other Settings => Preferences for New Projects

点击下拉框 将 Kotlin to JVM 修改成 1.8