()
Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
    using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
    Conclusion:
    ndk-r8e  -> use gcc4.7
    ndk-r9   -> use gcc4.8
Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
    using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
    Conclusion:
    ndk-r8e  -> use gcc4.7
    ndk-r9   -> use gcc4.8
Because ndk - r8e uses gcc4 . 6 as default . gcc4 . 6 doesn t support c ++ 11 . So we should select gcc4 . 7 when using ndk - r8e . But gcc4 . 7 is removed in ndk - r9 so we should determine whether gcc4 . 7 exist . Conclusion : ndk - r8e - > use gcc4 . 7 ndk - r9 - > use gcc4 . 8
def select_toolchain_version():
    '''
    Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
    using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
    Conclusion:
    ndk-r8e  -> use gcc4.7
    ndk-r9   -> use gcc4.8
    '''

    ndk_root = check_environment_variables()
    if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.9")):
        os.environ['NDK_TOOLCHAIN_VERSION'] = '4.9'
        print "The Selected NDK toolchain version was 4.9!"
    elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")):
        os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8'
        print "The Selected NDK toolchain version was 4.8!"
    elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.7")):
        os.environ['NDK_TOOLCHAIN_VERSION'] = '4.7'
        print "The Selected NDK toolchain version was 4.7!"
    else:
        print "Couldn't find the gcc toolchain."
        exit(1)
def select_toolchain_version ( ) : ndk_root = check_environment_variables ( ) if os . path . isdir ( os . path . join ( ndk_root , "toolchains/arm-linux-androideabi-4.9" ) ) : os . environ [ 'NDK_TOOLCHAIN_VERSION' ] = '4.9' print "The Selected NDK toolchain version was 4.9!" elif os . path . isdir ( os . path . join ( ndk_root , "toolchains/arm-linux-androideabi-4.8" ) ) : os . environ [ 'NDK_TOOLCHAIN_VERSION' ] = '4.8' print "The Selected NDK toolchain version was 4.8!" elif os . path . isdir ( os . path . join ( ndk_root , "toolchains/arm-linux-androideabi-4.7" ) ) : os . environ [ 'NDK_TOOLCHAIN_VERSION' ] = '4.7' print "The Selected NDK toolchain version was 4.7!" else : print "Couldn't find the gcc toolchain." exit ( 1 )