From 2bdabbbcc009f36a8ed9ee9a5ee04c6f79c2191c Mon Sep 17 00:00:00 2001 From: maning Date: Sat, 1 Apr 2017 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E8=A3=85APK=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/maning/gankmm/ui/activity/MainActivity.java | 3 ++- app/src/main/java/com/maning/gankmm/utils/InstallUtils.java | 2 ++ build.gradle | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/maning/gankmm/ui/activity/MainActivity.java b/app/src/main/java/com/maning/gankmm/ui/activity/MainActivity.java index b2e4df7..42eec09 100644 --- a/app/src/main/java/com/maning/gankmm/ui/activity/MainActivity.java +++ b/app/src/main/java/com/maning/gankmm/ui/activity/MainActivity.java @@ -501,7 +501,6 @@ public void onStart() { @Override public void onComplete(String path) { KLog.i("onComplete:" + path); - InstallUtils.installAPK(context, path); if (dialogCloseWarn != null) { dialogCloseWarn.dismiss(); } @@ -509,6 +508,8 @@ public void onComplete(String path) { return; } dialogUpdate.dismiss(); + //安装APK + InstallUtils.installAPK(context, path); } @Override diff --git a/app/src/main/java/com/maning/gankmm/utils/InstallUtils.java b/app/src/main/java/com/maning/gankmm/utils/InstallUtils.java index 1f6fda2..08460f2 100644 --- a/app/src/main/java/com/maning/gankmm/utils/InstallUtils.java +++ b/app/src/main/java/com/maning/gankmm/utils/InstallUtils.java @@ -181,6 +181,8 @@ public static void installAPK(Context context, String filePath) { intent.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); + //关闭旧版本的应用程序的进程 + android.os.Process.killProcess(android.os.Process.myPid()); } } diff --git a/build.gradle b/build.gradle index d0920fa..f1d1abb 100644 --- a/build.gradle +++ b/build.gradle @@ -32,8 +32,8 @@ ext { buildToolsVersion = "25.0.2" minSdkVersion = 16 targetSdkVersion = 25 - versionCode = 16 - versionName = "1.5.1" + versionCode = 15 + versionName = "1.5.0" storePassword = "123456" keyAlias = "Gank" keyPassword = "123456"