Android API与renderscript.type类不一致

时间:2021-07-20 14:59:41

I am using android.support.v8.renderscript API, and I want to use the static function ‘createX’ of the class ‘Type’. It seems that ‘createX’ does not exist in ‘Type’! And when I use it, I get this error:

我正在使用android.support.v8.renderscript API,我想使用类'Type'的静态函数'createX'。 'Type'中似乎不存在'createX'!当我使用它时,我收到此错误:

Cannot resolve method 'createX(android.support.v8.renderscript.RenderScript, android.support.v8.renderscript.Element, int)'

But when I change the API to android.renderscript, it seems ok, and no error occurs. I have these lines in my build.gradle:

但是当我将API更改为android.renderscript时,似乎没问题,并且没有错误发生。我在build.gradle中有这些行:

    renderscriptTargetApi 19
    renderscriptSupportModeEnabled true

Does anyone know how to solve this problem? I am supposed to use android.support.v8.renderscript, not android.renderscript.

有谁知道如何解决这个问题?我应该使用android.support.v8.renderscript,而不是android.renderscript。

1 个解决方案

#1


Type.createX() was only added in API 21. As you are using renderscriptTargetApi 19, you only get access to API 19 Renderscript methods - change it to target the latest (at this time, 22) to use methods introduced in later API levels. Note that all methods are supported back to API 8.

Type.createX()仅在API 21中添加。当您使用renderscriptTargetApi 19时,您只能访问API 19 Renderscript方法 - 将其更改为最新目标(此时为22)以使用在以后API级别中引入的方法。请注意,API 8支持所有方法。

#1


Type.createX() was only added in API 21. As you are using renderscriptTargetApi 19, you only get access to API 19 Renderscript methods - change it to target the latest (at this time, 22) to use methods introduced in later API levels. Note that all methods are supported back to API 8.

Type.createX()仅在API 21中添加。当您使用renderscriptTargetApi 19时,您只能访问API 19 Renderscript方法 - 将其更改为最新目标(此时为22)以使用在以后API级别中引入的方法。请注意,API 8支持所有方法。