Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Important ] Violations on android P Restrictions on non-SDK interfaces #19067

Closed
narychen opened this issue Apr 29, 2018 · 6 comments
Closed
Labels
Bug Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@narychen
Copy link
Contributor

narychen commented Apr 29, 2018

Run react-native app on android P emulator will throw out a caution of non-sdk usage.
The link is https://developer.android.com/preview/restrictions-non-sdk-interfaces
And a bunch of react-native native android code use refection or other non-sdk that will cause
the app not working on Android P.
A example piece of code is in ReactTextInputManager.java

  private void setCursorColor(ReactEditText view, @Nullable Integer color) {
    // Evil method that uses reflection because there is no public API to changes
    // the cursor color programmatically.
    // Based on http://stackoverflow.com/questions/25996032/how-to-change-programatically-edittext-cursor-color-in-android.
    try {
      // Get the original cursor drawable resource.
      Field cursorDrawableResField = TextView.class.getDeclaredField("mCursorDrawableRes"); 
      cursorDrawableResField.setAccessible(true);
      int drawableResId = cursorDrawableResField.getInt(view);

      // T

Use reflection TextView.class.getDeclaredField("mCursorDrawableRes")

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions.

How to ContributeWhat to Expect from Maintainers

@narychen narychen changed the title Violations of Restrictions on non-SDK interfaces android P [ Important ] Violations of Restrictions on non-SDK interfaces android P Apr 29, 2018
@narychen narychen changed the title [ Important ] Violations of Restrictions on non-SDK interfaces android P [ Important ] Violations on android P Restrictions on non-SDK interfaces Apr 29, 2018
@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label May 7, 2018
@react-native-bot
Copy link
Collaborator

This issue was marked as lacking information required by the issue template. There has been no activity on this issue for a while, so I will go ahead and close it.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

If you are the author of this issue and you believe this issue was closed in error (i.e. you have edited your issue to ensure it meets the template requirements), please let us know.

@hramos
Copy link
Contributor

hramos commented Jan 31, 2019

What's the status of this issue?

@rickhanlonii
Copy link
Member

Doesn't look like there's anything actionable here and there's been no activity in awhile so we're going to close but if there's more information we are happy to re-open

@joshfriend
Copy link

The non-sdk interfaces restrictions are getting tighter in Android Q, this should remain open.

The specific field mCursorDrawableRes that is still being obtained by reflection by ReactTextInputManager is listed in the sdk graylist. As I understand it, any app that targets Android Q and uses this will crash now because of the restriction.

When this was reported almost a year ago, there should have been an effort to request that the API be made public as described here. I am not the original poster of the issue, so I do not know for sure if this hasn't been done, but a quick search on google's bugtracker under the relevant component does not reveal any such requests.

@narychen

This comment has been minimized.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants