Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Remove TargetAPI Annotations #934

Closed
Closed

Description

@bleege

The @TargetAPI annotations just hide things from Lint and create spaghetti code. Either something works for the supported API range or it doesn't. For more background see this issue from the Raster SDK.

Activity

  1. added
    Android
    on Mar 2, 2015
  2. changed the title [-]Remote TargetAPI Annotations[/-] [+]Remove TargetAPI Annotations[/+] on Mar 2, 2015
  3. ljbade commented on Mar 2, 2015

    @ljbade
    Contributor

    Well we can remove them and make API level errors warning instead, but then I won't be at zero errors/warnings again.

    Perhaps we just drop support for Android 2.x completely?

  4. bleege commented on Mar 2, 2015

    @bleege
    ContributorAuthor

    then I won't be at zero errors/warnings again.

    That's a good thing! It means that the stuff to fix is visible and not hiding waiting for the most inopportune time to cause trouble. :-)

    Perhaps we just drop support for Android 2.x completely?

    API 8 would probably be okay to drop, but there are still a healthy sliver of API 10 devices around.

  5. added this to the milestone on Aug 13, 2015
  6. bleege commented on Aug 13, 2015

    @bleege
    ContributorAuthor

    Here's an updated API Market Share report from the Android Dashboard. Based on this I think we should definitely drop Froyo and possibly drop Gingerbread. Ice Cream Sandwich was a major change UI wise as well as some updates to core UI classes (like View) and Input handling.

    If we kept Gingerbread and up that would put the minimum at API 10 / 11. If we kept Ice Cream Sandwich and up that would put the minimum at API 14. Thoughts @ljbade @incanus?

    20150813-android-api-market-share

  7. self-assigned this
    on Aug 13, 2015
  8. incanus commented on Aug 13, 2015

    @incanus
    Contributor

    Weird that Gingerbread has more than ICS. Is there a good rationale for that?

    Also, maybe dates here would be useful as we think about how old particular releases matter (though I realize market share is more important).

  9. mb12 commented on Aug 13, 2015

    @mb12

    Maybe that's because all carriers push at least one OS upgrade. Majority Froyo device got upgraded to Gingerbread and ICS to Jellybean.

  10. bleege commented on Aug 19, 2015

    @bleege
    ContributorAuthor

    According to Wikipedia's Android Version History here's how things break out:

    Codename Version Release Date
    Gingerbread 2.3.7 21-Sept-2011
    Ice Cream Sandwich 4.0.3 16-Dec-2011
    Ice Cream Sandwich 4.0.4 29-Mar-2012
    Jelly Bean 4.1.* 9-July-2012
    Jelly Bean 4.2.* 13-Nov-2012
    Jelly Bean 4.3.* 24-July-2013
    KitKat 4.4 31-Oct-2013
    Lollipop 5.0 12-Nov-2014
    Marshmallow 6.0 Promised Fall 2015

    The trend is that Google is moving to an annual Android OS release cycle like Apple does with iOS, and then updates it's own apps / services via Google Play Services whenever it wants / needs to.

    Based on the marketshare numbers above and running lint on the MapboxGLAndroidSDK doesn't trip on any API range specific things for now, let's go to API 10 as a floor. More importantly though, let's also remove all @TargetAPI annotations (and promise not to use them in the future!). Lint is your friend.

  11. ljbade commented on Aug 20, 2015

    @ljbade
    Contributor

    Hmm OK lets remove the annotations, and just live with the warnings about using newer functions even though we have version check?

    Also I think I might have to look at the memory cache size tuning, currently using function that only exists in API 16 for that.

  12. added a commit that references this issue on Aug 20, 2015
  13. bleege commented on Aug 20, 2015

    @bleege
    ContributorAuthor

    I raised the Minimum SDK to 10, removed the @TargetAPI suppression annotations, and then ran Lint. Here are the results:

    screen shot 2015-08-20 at 3 14 25 pm
    Overall Results

    screen shot 2015-08-20 at 3 14 44 pm
    First API Version Violation

    screen shot 2015-08-20 at 3 15 14 pm
    Second API Version Violation

    The 2 API Version Violations are related. I'll investigate to see if there's a way around them so that the SDK will truly be API 10 and above for support.

  14. mb12 commented on Aug 20, 2015

    @mb12

    @bleege Does linter also catch issue with external libs/jars? For e.g. would an issue like #2009 be caught by linter?
    I noticed a potentially similar issue when trying to do a proguard enabled build. It looks like OkHttp has a transitive dependency on java.lang.ReflectiveOperationException which was added in Api Level 19 (Related issue #2130).

  15. 15 remaining items

  16. ljbade commented on Aug 21, 2015

    @ljbade
    Contributor

    @bleege For a while I has been thinking we should support only API 15 / Android 4.x and above.

    Reasons:

    • low market share of older devices
    • I personally do not know anyone who still uses one of these older phones
    • the performance on these older phones is likely too low to smoothly run GL maps, particularly more complex styles
  17. ljbade commented on Aug 21, 2015

    @ljbade
    Contributor

    @bleege - the compass lint error, this should be fixed when we get some nice material design artwork for it, with correct densities

  18. reopened this on Oct 25, 2015
  19. ljbade commented on Oct 25, 2015

    @ljbade
    Contributor

    EDIT: moving to the right issue #2784

  20. added 5 commits that reference this issue on Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions