From 7a9572f48943e4d8127e7b6d94328daf1605fdc6 Mon Sep 17 00:00:00 2001 From: hedex Date: Wed, 11 Apr 2018 16:01:49 +0800 Subject: [PATCH 1/2] fix gradle 3.1 bug Signed-off-by: hedex --- .../gradle/plugin/RobustApkHashAction.groovy | 23 ++++++++++++++++++- gradle.properties | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gradle-plugin/src/main/groovy/robust/gradle/plugin/RobustApkHashAction.groovy b/gradle-plugin/src/main/groovy/robust/gradle/plugin/RobustApkHashAction.groovy index 2d876d0c..32fa366e 100755 --- a/gradle-plugin/src/main/groovy/robust/gradle/plugin/RobustApkHashAction.groovy +++ b/gradle-plugin/src/main/groovy/robust/gradle/plugin/RobustApkHashAction.groovy @@ -204,11 +204,32 @@ class RobustApkHashAction implements Action { public static boolean isGradlePlugin300orAbove() { try { - String gradlePluginVersion = com.android.builder.Version.ANDROID_GRADLE_PLUGIN_VERSION + String gradlePluginVersion = getGradlePluginVersion() return gradlePluginVersion.compareTo("3.0.0") >= 0; } catch (Throwable throwable) { } return false; } + + static String getGradlePluginVersion() { + String version = null + try { + def clazz = Class.forName("com.android.builder.Version") + def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION") + field.setAccessible(true) + version = field.get(null) + } catch (Exception ignore) { + } + if (version == null) { + try { + def clazz = Class.forName("com.android.builder.model.Version") + def field = clazz.getDeclaredField("ANDROID_GRADLE_PLUGIN_VERSION") + field.setAccessible(true) + version = field.get(null) + } catch (Exception ignore) { + } + } + return version + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0e4991cb..c7998d02 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,6 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.80 +VERSION_NAME=0.4.81 GROUP=com.meituan.robust From 081547fe1db68c321d4c1b6fd7979abfc21b0976 Mon Sep 17 00:00:00 2001 From: hedex Date: Wed, 11 Apr 2018 16:06:21 +0800 Subject: [PATCH 2/2] update readme Signed-off-by: hedex --- .github/ISSUE_TEMPLATE.md | 2 +- README-zh.md | 8 ++++---- README.md | 8 ++++---- build.gradle | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b76f1df5..0e0d0665 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,7 +6,7 @@ 手机系统版本:如:Android 5.0 (如是编译异常,则可以不填) -Robust版本:如:0.4.80 +Robust版本:如:0.4.81 Gradle版本:如:2.10 diff --git a/README-zh.md b/README-zh.md index 26a951df..4d533ee9 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,6 +1,6 @@ # Robust - [![Download](https://api.bintray.com/packages/meituan/maven/com.meituan.robust%3Apatch/images/download.svg?version=0.4.80) ](https://bintray.com/meituan/maven/com.meituan.robust%3Apatch/0.4.80/link) + [![Download](https://api.bintray.com/packages/meituan/maven/com.meituan.robust%3Apatch/images/download.svg?version=0.4.81) ](https://bintray.com/meituan/maven/com.meituan.robust%3Apatch/0.4.81/link) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Meituan-Dianping/Robust/pulls) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/Meituan-Dianping/Robust/master/LICENSE) @@ -28,7 +28,7 @@ apply plugin: 'robust' - compile 'com.meituan.robust:robust:0.4.80' + compile 'com.meituan.robust:robust:0.4.81' ``` 2. 在整个项目的build.gradle加入classpath @@ -39,8 +39,8 @@ jcenter() } dependencies { - classpath 'com.meituan.robust:gradle-plugin:0.4.80' - classpath 'com.meituan.robust:auto-patch-plugin:0.4.80' + classpath 'com.meituan.robust:gradle-plugin:0.4.81' + classpath 'com.meituan.robust:auto-patch-plugin:0.4.81' } } ``` diff --git a/README.md b/README.md index 99bb89e3..46bca624 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Robust -[![Download](https://api.bintray.com/packages/meituan/maven/com.meituan.robust%3Apatch/images/download.svg?version=0.4.80) ](https://bintray.com/meituan/maven/com.meituan.robust%3Apatch/0.4.80/link) +[![Download](https://api.bintray.com/packages/meituan/maven/com.meituan.robust%3Apatch/images/download.svg?version=0.4.81) ](https://bintray.com/meituan/maven/com.meituan.robust%3Apatch/0.4.81/link) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Meituan-Dianping/Robust/pulls) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/Meituan-Dianping/Robust/master/LICENSE) @@ -26,7 +26,7 @@ Robust is an Android HotFix solution with high compatibility and high stability. //please uncomment fellow line before you build a patch //apply plugin: 'auto-patch-plugin' apply plugin: 'robust' - compile 'com.meituan.robust:robust:0.4.80' + compile 'com.meituan.robust:robust:0.4.81' ``` 2. Add below codes in the outest project's build.gradle file. @@ -36,8 +36,8 @@ Robust is an Android HotFix solution with high compatibility and high stability. jcenter() } dependencies { - classpath 'com.meituan.robust:gradle-plugin:0.4.80' - classpath 'com.meituan.robust:auto-patch-plugin:0.4.80' + classpath 'com.meituan.robust:gradle-plugin:0.4.81' + classpath 'com.meituan.robust:auto-patch-plugin:0.4.81' } } ``` diff --git a/build.gradle b/build.gradle index 3b6ed94c..459cb9ee 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ buildscript { classpath 'com.android.tools.build:gradle:2.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.meituan.robust:gradle-plugin:0.4.80' - classpath 'com.meituan.robust:auto-patch-plugin:0.4.80' + classpath 'com.meituan.robust:gradle-plugin:0.4.81' + classpath 'com.meituan.robust:auto-patch-plugin:0.4.81' classpath 'me.tatarka:gradle-retrolambda:3.2.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'