private void closeAndroidPDialog(){ try { Class aClass = Class.forName("android.content.pm.PackageParser$Package"); Constructor declaredConstructor = aClass.getDeclaredConstructor(String.class); declaredConstructor.setAccessible(true); } catch (Exception e) { e.printStackTrace(); } try { Class cls = Class.forName("android.app.ActivityThread"); Method declaredMethod = cls.getDeclaredMethod("currentActivityThread"); declaredMethod.setAccessible(true); Object activityThread = declaredMethod.invoke(null); Field mHiddenApiWarningShown = cls.getDeclaredField("mHiddenApiWarningShown"); mHiddenApiWarningShown.setAccessible(true); mHiddenApiWarningShown.setBoolean(activityThread, true); } catch (Exception e) { e.printStackTrace(); } }
將這個方法在app初始化時候調用一次,這個彈窗就不會出現了android