Android buidl failed: have not accepted the license agreements

One way this can happen is if your package.xml in Engine/Source/ThirdParty/Android is damaged (for example ends up with PC line endings rather than UNIX line endings). If you fix that file you can then delete the android-sdk-license file and then re-accept the eula’s in project settings.