Flutter 打包Android apk报错,提示内容为
Execution failed for task ':shared_preferences:verifyReleaseResources'.
...
A problem occurred configuring root project 'fluttertoast'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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.
根据提示校验项目,并没有发现什么SDK location配置错误的问题,在新的项目中加入Flutter toast也可以打包成功,对比一个新建的Flutter项目来全都一摸一样,真让人头大。最后尝试单独打开Android目录,进入纯Android工程编译打包,可以打包成功,并且可以正常安装运行。具体问题在哪里真搞不明白,如果有知道如何从根本上解决问题的老师,还望指点一二,这里记录一下临时解决方法,如果能帮到你,那我这几句话就有存在的意义。