0

I am trying to decrease my Android SDK version from 25 to 22. The reason is that when I run the program Android asks the user if it can record them. This is not ideal because users will then be afraid to use it.

  • I have tried Microphone permission but I have read that this permission does not work due to it being a a permission-group.

I have read that using SDK 22 will allow users to agree to Record_Audio upon app installation. The problem here is that when I do that several errors appear including:

Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

This error is appearing inside build files debug/values-v23/values-v23.xml and v24.

I have downgraded compileSdkVersion to 22, target sdk version to 22.0.1. Installed 22.0.1 build tools and downgrading com.android.tools.build:gradle to 2.2.3. So far everything I have tried has still caused these errors, any help will be appreciated.

I am also asking this question to discover if there is a way to allow an app to use the microphone to without needing Record_Audio. Furthermore, if there was a way to ask this permission while using different language, that would also be preferable.

stringVector
  • 1,923
  • 2
  • 12
  • 11
  • "The reason is that when I run the program Android asks the user if it can record them" -- the user is always prompted for permissions, and so the user will be prompted for the `RECORD_AUDIO` permission. The difference is solely in the timing. Beyond that, clean your project (e.g., Build > Clean Project in the Android Studio main menu). – CommonsWare Jul 24 '17 at 18:05
  • Possible duplicate of [Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23](https://stackoverflow.com/questions/32075498/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name) – Zoe Jul 24 '17 at 18:07

2 Answers2

1

When you change the OS version (target API) you need to change the version of the support library to match the API version. For an instance when you target API 22, the support library has to be version 22 as well.

Zoe
  • 27,060
  • 21
  • 118
  • 148
0

You should not lower your target SDK version to circumvent needing to request permissions at runtime.

This is a bad idea for a few reasons:

  • First and foremost, this is a user-hostile decision. Runtime permissions were added in Marshmallow (API 23) to give users better control over how apps use their devices and access personal information. It helps users understand how you use those permissions and why you need them.

  • Second, by using a lower target SDK version, you lock yourself out of any new Android APIs and platform features introduced since Marshmallow. Marshmallow was released in 2015, so you are already 2 years behind and that gap will only continue to grow.

  • Finally, any user running Marshmallow or newer will be able to revoke this permission to your application regardless of what API level you target.

That being said, if you lower the target/compile SDK version, you also need to change the support library version. Newer versions of the support library use newer APIs and thus are not compatible with older SDK versions.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • Thanks for your quick response. This application has very little functionality which will probably not change is the future. Furthermore, this being resolved is a requirement of our client. When you are referring to "support library" are you referring to com.android.support:support-core-utils ? I have added this dependency at version 22.0.0 with no change. – stringVector Jul 24 '17 at 18:51
  • It only helps the users understand how the app uses the permissions if it is explained. Permissions can still be revoked even if the app doesn't target API 23 (THAT is worth noting) – Zoe Jul 24 '17 at 18:58
  • @stringVector any dependency starting with `com.android.support` needs to be updated. You should ensure that your company makes an effort to educate your client on the new Android permissions model so that they understand the tradeoff they are making, particularly that users can still revoke the permission on newer devices. – Bryan Herbst Jul 24 '17 at 19:15