Android - redefining class removed from support library (AsyncTaskCompat)

Rog :

Firstly, apologies if I have not included all the required info for this question to be answered. I am somewhat new to Android development and am still getting my head around the build tools, API levels etc. So please let me know if there is any additional info I should provide to help you help me!

After updating my Android project compile sdk version to 27, I realised that version 27.0.2 of com.android.support:support-v4 no longer includes AsyncTaskCompat (that class has been deprecated & removed).

I have a third party library that is not open source, not easily replaceable, is no longer supported and still uses AsyncTaskCompat.

Since AsyncTaskCompat is open source, I was thinking I could simply reintroduce it somehow by redefining it in my project.

I've tried redefining it under my project in com.android.support.v4.os but even though the project compiles without any issues, when I run the section of the app that uses the third party library I get a crash with a class not found error for AsyncTaskCompat.

Is there something obvious I might be missing?

Denny Weinberg :

No need to add a specific Android Library module.

Only add the classes bellow to your project using the package name "android.support.v4.os":

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=438887&siteId=1