编译 Android RenderScript 示例时出错

发布于 2025-01-02 22:32:52 字数 1597 浏览 1 评论 0原文

当我尝试编译任何 Android RenderScript 示例代码(SDK 版本 11)时,出现以下错误。

[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:35:33: error: unknown type name 'rs_matrix4x4'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:40:33: error: unknown type name 'rs_matrix3x3'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:45:33: error: unknown type name 'rs_matrix2x2'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:55:27: warning: declaration specifier missing, defaulting to 'int'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:88:71: error: unknown type name 'float2'; did you mean 'float'?
...

我四处搜寻,看看其他人是否也遇到类似的问题。

例如,这篇文章 Renderscript 示例构建错误提到 Android-11 中的 /renderscript 目录到 Android -13 需要使用 Android-14+ 中 /renderscript 目录的内容进行更新。我有从2.1到4.0.3的所有SDK版本,并且没有:

 /platforms/android-14/renderscript

目录。我能够构建和运行不使用 RenderScript 的项目。

有没有人找到解决方案?或者有人可以告诉我我在这里做错了什么?我只需选择“文件”>“新建”>“Android 项目”>“从现有示例创建项目”。如果我选择任何 RenderScript 示例,我将无法编译该项目。

我还注意到 /raw 目录(layout、drawable 等的同级目录)最初附带一个文件(在我的例子中为 carousel.bc),但是当我编译时,该文件被删除 - 这似乎并不存在对我来说是对的。

谢谢你的帮助!

I get the following errors when I try to compile any Android RenderScript sample code (SDK version 11).

[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:35:33: error: unknown type name 'rs_matrix4x4'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:40:33: error: unknown type name 'rs_matrix3x3'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:45:33: error: unknown type name 'rs_matrix2x2'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:55:27: warning: declaration specifier missing, defaulting to 'int'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:88:71: error: unknown type name 'float2'; did you mean 'float'?
...

I've searched around to see if others are having similar issues.

This post Renderscript samples build errors for example mentions that the /renderscript directory in Android-11 to Android-13 needs to be updated with the contents of the /renderscript directory from Android-14+. I have all the SDK versions from 2.1 to 4.0.3 and there's no:

 /platforms/android-14/renderscript

directory. I am able to build and run my projects that don't use RenderScript.

Has anyone found a solution for this? Or can someone tell me what I'm doing incorrectly here? I just select File>New>Android Project>Create project from existing sample. If I select any RenderScript samples I'm unable to compile the project.

I've also noticed that the /raw directory (sibling directories of layout, drawable, etc.) initially comes with a file (in my case carousel.bc), but when I compile, this file is deleted - which doesn't seem right to me.

Thanks for you help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坏尐絯 2025-01-09 22:32:52

所以经过更多的挖掘之后。我决定为 Android-11 SDK 安装 Google API,这似乎解决了问题。我必须在 carousel.rs 文件中修复一个语法错误。

cards[i].cardVisible = (p >= visibleFirst && p < visibleLast)
                    || (p <= visibleFirst && p > visibleLast);

需要添加最后两个括号。

希望我能够从 Android 开发者网站找到这一点。没有任何地方说需要下载“Google API's by Google”才能编译 RenderScript。

So after some more digging around. I decided to install the Google APIs for the Android-11 SDK and that seemed to fix things. There was still one syntax error I had to fix in the carousel.rs file.

cards[i].cardVisible = (p >= visibleFirst && p < visibleLast)
                    || (p <= visibleFirst && p > visibleLast);

The last two parentheses need to be added.

Wish I would have been able to find this out from the Android developer site. Nowhere does it say the "Google API's by Google" need to be downloaded in order to compile RenderScript.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文