在Android Studio中运行Flutter时,报错如下:
What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
NDK at D:\Compiler\Android\ndk-bundle did not have a source.properties file
解决思路:
根据网上文章NDK at /User/**/Android/sdk/ndk-bundle did not have a source.properties file的评论链接https://blog.csdn.net/xiangwang2015/article/details/121740391并不能解决问题,但是新的问题提示指明了问题所在。
What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
NDK from ndk.dir at D:\Compiler\Android\ndk\21.4.7075529 had version [21.4.7075529] which disagrees with android.ndkVersion [21.1.6352462]
提示明确指出了ndk版本不一致的问题。
解决方法:
只需要在flutter sdk中,路径flutter>packages>flatter_tools>gradle>flutter.gradle更改ndkVersion版本,改为本地已存在的ndk版本,或者在sdk manager中安装flutter指定的ndk版本。