When I try to generate a signed APK, I found this issue :
10:58 Generate Signed APK: Errors while building APK. You can find the errors in the \'Messa
Please use Analyze > Inspect Code to inspect your code
If your app could be compiled and running just fine but you failed to generate sign APK. For me, after running inspection it shows me a few errors in my code. I fixed all those errors then I could build sign APK just fine. Check this Answer for more option to fix this