Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.0-beta-3
-
Tried using Groovy Android plugin on Android lower than 5.0 Lollipop. Seems to happen also on 'normal' Groovy code.
Description
As of Android 5.0 (API 21), Bundle (http://developer.android.com/reference/android/os/Bundle.html) class now inherits from BaseBundle (http://developer.android.com/reference/android/os/BaseBundle.html), which was added on API 21.
As now `putInt()`, `putString()`, etc. - former Bundle methods - are methods of BaseBundle which Bundle inherits but not override, for some reason on API versions lower than 21 when you try to call those methods from a Bundle object it will throw:
java.lang.NoClassDefFoundError: android.os.BaseBundle
If you call its constructor, which in API 21 only does:
public Bundle() {
super();
}
It will work as Groovy still looks for the constructor on that class and while on API lower than 21 the code is different, there is no problem.
So even when the BaseBundle class is not there Groovy still tries to call it. If you try to use those methods on a `.java` file they will work flawlessly.