Closed
Description
openedon Jun 14, 2017
Hello,
When I use dexcount 0.7.0 with Android Gradle Plugin 2.3.1 and Gradle 3.3 I got the following exception:
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.uncapitalize() is applicable for argument types: () values: []
Possible solutions: capitalize()
at com.getkeepsafe.dexcount.DexMethodCountPlugin$Provider.createTask(DexMethodCountPlugin.groovy:177)
at com.getkeepsafe.dexcount.DexMethodCountPlugin$LegacyProvider$_applyToApkVariant_closure2.doCall(DexMethodCountPlugin.groovy:217)
at com.getkeepsafe.dexcount.DexMethodCountPlugin$LegacyProvider.applyToApkVariant(DexMethodCountPlugin.groovy:215)
at com.getkeepsafe.dexcount.DexMethodCountPlugin$LegacyProvider.applyToApplicationVariant(DexMethodCountPlugin.groovy:197)
at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:382)
at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:170)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:80)
at com.getkeepsafe.dexcount.DexMethodCountPlugin$Provider$_apply_closure1.doCall(DexMethodCountPlugin.groovy:134)
...
The reasons are:
- Method uncapitalize() is used by DexMethodCountPlugin.Provider.
- Method CharSequence.uncapitalize() is supported since Groovy 2.4.8.
- Version of Groovy bundled with Gradle 3.3 is 2.4.7. Only in Gradle 3.5 this version is upgraded to 2.4.10.
The hot fix solution is to declare uncapitalize method:
String.metaClass.uncapitalize = {
if (delegate.length() <= 1) return delegate.toLowerCase()
return delegate[0].toLowerCase() + delegate[1..-1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels