简体   繁体   English

是否可以在Android SDK 23+上使用RenderScript

[英]Is it possible to use RenderScript on Android SDK 23+

I've been struggling with getting RenderScript to work on my app with a TargetSDKVersion 26 and a minSDKVersion 21 getting an error at Gradle Sync: 我一直在努力使RenderScript在TargetSDKVersion 26和minSDKVersion 21上运行于我的应用程序,但在Gradle Sync出现错误:

Error:Execution failed for task ':app:compileDebugRenderscript'. 错误:任务':app:compileDebugRenderscript'的执行失败。 com.android.ide.common.process.ProcessException: Error while executing process /home/mail929/.android/sdk/build-tools/26.0.2/llvm-rs-cc with arguments {-O 3 -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/include/ -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/clang-include/ -p /home/mail929/Code/Android/SmartME/app/build/generated/source/rs/debug -o /home/mail929/Code/Android/SmartME/app/build/generated/res/rs/debug/raw -target-api 21 /home/mail929/Code/Android/SmartME/app/src/main/rs/combine.rs} com.android.ide.common.process.ProcessException:执行进程/home/mail929/.android/sdk/build-tools/26.0.2/llvm-rs-cc时出现错误,参数为{-O 3 -I / home / mail929 / .android / sdk / build-tools / 26.0.2 / renderscript / include / -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/clang-include/ -p / home / mail929 /代码/ Android / SmartME / app / build / Generated / source / rs / debug -o / home / mail929 / Code / Android / SmartME / app / build / Generated / res / rs / debug / raw -target-api 21 /home/mail929/Code/Android/SmartME/app/src/main/rs/combine.rs}

Eventually I noticed at the bottom of the documentation page : 最终我注意到文档页面的底部:

Graphics Functions and Types 图形功能和类型

The graphics subsystem of RenderScript was removed at API level 23. RenderScript的图形子系统在API级别23被删除。

Does this mean I can't use RenderScript at all? 这是否意味着我根本无法使用RenderScript? If so are there any good alternatives? 如果是这样,有什么好的选择吗?

Here is my complete build.gradle: 这是我完整的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "edu.marquette.mcw.smartme"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 4
        versionName "2rc1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        renderscriptTargetApi 18
        renderscriptSupportModeEnabled false

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:cardview-v7:26.0.0'

    testCompile 'junit:junit:4.12'
}

No, Renderscript hasn't been completely deprecated, only the graphics functionality which operated on some OpenGL type constructs directly. 不,Renderscript还没有被完全弃用,只是直接在某些OpenGL类型构造上运行的图形功能。 Since it was more or less doing the same thing available in OpenGL, it was dropped and instead you can exchange textures with OpenGL. 由于它或多或少都在执行OpenGL中可用的相同操作,因此已将其删除,而可以与OpenGL交换纹理。

The combination of minSdkVersion and renderscriptTargetApi in your build.gradle will result in the minSdkVersion being used for the Renderscript target API. 的组合minSdkVersionrenderscriptTargetApi在你build.gradle将导致minSdkVersion被用于的renderScript目标API。 The way this works can get really odd. 这种工作方式可能真的很奇怪。 Unless you absolutely need something in the android.renderscript framework package, use the support library version by setting renderscriptSupportModeEnabled to true . 除非您绝对需要android.renderscript框架包中的内容,否则通过将renderscriptSupportModeEnabled设置为true来使用支持库版本。 This may also help resolve whatever issue you are seeing. 这也可能有助于解决您遇到的任何问题。 If it doesn't, try to provide more details from the build log. 如果不是,请尝试从构建日志中提供更多详细信息。

Well I actually decided to manually run the command to see what was wrong and recevied the following error: 好吧,我实际上决定手动运行命令以查看出了什么问题,并纠正了以下错误:

error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory 加载共享库时出错:libncurses.so.5:无法打开共享库文件:没有这样的文件或目录

I fixed this by installing ncurses-compat-libs on Fedora and Gradle Sync completes successfully 我通过在Fedora上安装ncurses-compat-libs来解决此问题,并且Gradle Sync成功完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android SDK 23+服务中的权限 - Android SDK 23+ Permissions in Services 在API 23+上可以忽略AppCompat吗? - Is AppCompat possible to ignore on API 23+? 除非我在android SDK 23+上手动将其关闭和打开,否则READ_CONTACTS权限无法正常工作 - READ_CONTACTS permission is not working unless i manually turn it off & on on android SDK 23+ Android Send SMS Permission可在其他23+设备上使用,但不适用于OnePlus 5 - Android Send SMS Permission working on other 23+ devices but not with the OnePlus 5 应用程序被杀死时的后台操作? (Android API 23+) - Background operations when app is killed? (Android API 23+) Android M(API 23+)运行时存储权限 - Android M (API 23+) runtime storage permissions 使用 Android 23+ 确定清单中是否存在权限 - Determine whether a permission is present in the manifest with Android 23+ 如何以编程方式获取Android设备的方向,api 23+ - How to get Android Device's orientation programatically, api 23+ Android 23+ - 从备份中排除 GCM 注册 ID - Android 23+ - Exclude GCM Registration ID from backup 目标并编译SDK版本23+时,无法在棉花糖中接收SMS - Can't receive SMS in Marshmallow when target & compile sdk version 23+
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM