1

I have some library in github that want to be more user friendly. For being more user friendly i want to check compatibility with my lib and main-app in compile-time.

This is how problem came: I have updated my lib for android Oreo and if user set targetSdkVersion to 27 it will be fine. Problem is when user set his app target to 27 but use my old lib version. This cause crash in my lib.

For checking compatibility of main app, i have to check targetSdkVersion of main app from my library. Is that possible? or is there any other way to force lib-user-app to meet my dependencies not just by documents?

Mahdi
  • 6,139
  • 9
  • 57
  • 109
  • I thought you need NOT to do so, Android make compatible with prev versions. No matter which targetSdkVersion your lib will works. only concern about `MinSdkVersion` – xingjiu Apr 24 '18 at 08:10
  • 1
    @xingjiu No. recently I had many problem with android 8.0. So if user use old version of lib and put their targetSdkVersion to 27 my lib crashes. this is the problem. But it is ok with my last version – Mahdi Apr 24 '18 at 13:04

1 Answers1

0

It seems you should care about Build.VERSION.SDK_INT in your lib instead of targetSdkVersion in the main app. After all, the app crashed because of Build.VERSION.SDK_INT does not match new Android feature.

Marcello B.
  • 4,177
  • 11
  • 45
  • 65