不让APP在模拟器运行在特殊的需求下还是要做一个的。

首先你需要一个这样的工具类。
FindEmulator {    String[] = {            }String[] = {}String[] = {}String[] = {}String[] = {}String[] = {}String[] = {}String[] = {}Property[] = {Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()Property()}TelephonyManager = Context FindEmulator(Context context) {        = context.getApplicationContext()}    () {        (String pipe : ) {
            File qemu_socket = File(pipe)(qemu_socket.exists()) {                }
        }        }    String () {        (String pipe : ) {
            File qemu_socket = File(pipe)(qemu_socket.exists()) {                pipe}
        }        }    () {        (String pipe : ) {
            File qemu_file = File(pipe)(qemu_file.exists()) {                }
        }        }    String () {        (String file : ) {
            File geny_file = File(file)(geny_file.exists()) {                file}
        }        }    () {        (String file : ) {
            File geny_file = File(file)(geny_file.exists()) {                }
        }        }    String () {        (String file : ) {
            File geny_file = File(file)(geny_file.exists()) {                file}
        }        }    () {        (File drivers_file : File[] {File()File()}) {            (drivers_file.exists() && drivers_file.canRead()) {                [] data = []{
                    InputStream is = FileInputStream(drivers_file)is.read(data)is.close()} (Exception exception) {
                    exception.printStackTrace()}

                String driver_data = String(data)(String known_qemu_driver : ) {                    (driver_data.contains(known_qemu_driver)) {                        }
                }
            }
        }        }    String () {        (File drivers_file : File[] {File()File()}) {            (drivers_file.exists() && drivers_file.canRead()) {                [] data = []{
                    InputStream is = FileInputStream(drivers_file)is.read(data)is.close()} (Exception exception) {
                    exception.printStackTrace()}

                String driver_data = String(data)(String known_qemu_driver : ) {                    (driver_data.contains(known_qemu_driver)) {                        known_qemu_driver}
                }
            }
        }        }    String () {        (== ) {            = (TelephonyManager) .getSystemService(Context.)}        .getSimSerialNumber()}    () {
        String phoneNumber = getSerialNumber()(String number : ) {            (number.equalsIgnoreCase(phoneNumber)) {                }

        }        }    String () {        (== ) {            = (TelephonyManager) .getSystemService(Context.)}        .getLine1Number()}    () {
        String phoneNumber = getPhoneNumber()(String number : ) {            (number.equalsIgnoreCase(phoneNumber)) {                }

        }        }    String () {        (== ) {            = (TelephonyManager) .getSystemService(Context.)}        .getDeviceId()}    () {
        String deviceId = getDeviceId()(String known_deviceId : ) {            (known_deviceId.equalsIgnoreCase(deviceId)) {                }
        }        }    String () {        (== ) {            = (TelephonyManager) .getSystemService(Context.)}        .getSubscriberId()}    () {
        String imsi = getImsi()(String known_imsi : ) {            (known_imsi.equalsIgnoreCase(imsi)) {                }
        }        }    () {        String BRAND = Build.String DEVICE = Build.String HARDWARE = Build.String MODEL = Build.String PRODUCT = Build.((BRAND.compareTo() == ) || (DEVICE.compareTo() == )
                || (MODEL.compareTo() == ) || (PRODUCT.compareTo() == )
                || (HARDWARE.compareTo() == )) {            }        }    String () {        (== ) {            = ((TelephonyManager) .getSystemService(Context.))}        .getNetworkOperatorName()}    () {
        String szOperatorName = getOperatorName()szOperatorName.equalsIgnoreCase()}    () {        found_props = (Property property : ) {
            String property_value = getProp(property.)(TextUtils.(property.) && !TextUtils.(property_value)) {
                found_props++} (!TextUtils.(property.) && !TextUtils.(property_value) &&
                        (property_value.contains(property.))) {                found_props++}
        }        (found_props >= ) {            }        }    String () {
        String ret = (Property property : ) {
            String property_value = getProp(property.)(TextUtils.(property.) && !TextUtils.(property_value)) {
                ret += property.+ + property_value + } (!TextUtils.(property.) && !TextUtils.(property_value) &&
                        (property_value.contains(property.))) {                ret += property.+ + property_value + }
        }        ret}    String (Context contextString property) {        {
            ClassLoader classLoader = context.getClassLoader()Class<?> systemProperties = classLoader.loadClass()Method get = systemProperties.getMethod(String.)Object[] params = Object[]params[] = String(property)(String) get.invoke(systemPropertiesparams)} (IllegalArgumentException iAE) {            iAE} (Exception exception) {            }
    }    Property {        String String Property(String nameString seek_value) {            .= name.= seek_value}
    }