如何在我的非 AppCompat 应用程序中使用 AppCompat 库?

How to use AppCompat library in my app which is not AppCompat?

我的应用程序不使用 AppCompat,因为我的 minSdkVersion15。我想在其中使用 smart-app-rate library 但我得到(这是预期的):

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

请注意,我无法将我的应用程序更改为 AppCompat,因为 A) 没有实际需要,B) 如果我这样做,我的应用程序看起来完全不同。

因此,我尝试以 ZIP 格式下载库并将其转换为不使用 AppCompat。我执行了 中提到的步骤,但现在我得到了一大堆错误(比如 ContextCompat.getColor,我需要用非 AppCompat 函数替换它)而且我不确定这是否正确这样做的方法。

如何轻松解决这个问题?

but now I get a whole bunch of errors (like ContextCompat.getColor, which I would need to replace with non-AppCompat function)

ContextCompatappcompat-v7无关。 ContextCompat来自support-compat,强烈推荐使用support-compat神器

and I am not sure if this is the right way to do this.

您可以根本不使用该库。否则,您别无选择,只能交叉移植它以删除其对 appcompat-v7.

的使用