In my app I need execute one function with targetSdkVersion = 22, however I want that my app has targetSdkVersion = 24. My attempt was create a module that after I added as a dependency of my app, where these module has targetSdkVersion = 22. The problem is that when I run the function from my module, it runs with the target = 24.
EDIT: Maybe I may have explained badly. I want execute the same function for all sdk, but the function just runs correctly if I set my app targetSdkVersion to 22. Exists some way to do that, without creating one secundary app with the target = 22 and call it from my main app ?
( I need targetSdkVersion = 22 to execute this line:
Settings.System.putInt(getContentResolver(), "button_key_light", -1)
In my app I need execute one function with targetSdkVersion = 22, however I want that my app has targetSdkVersion = 24
Sorry, that is not possible.
targetSdkVersion is for the entire app. The
targetSdkVersion that you provide in a module's will be overridden by the app's
targetSdkVersion by default. You might be able to rig up rules to have the module's
targetSdkVersion be the one that is used instead. But, in either case, the resulting value is used for the entire app, including your library module.