Zee*_*Zee 6 64-bit android android-renderscript
更新:好的,所以我进一步研究了这一点。设法使用bundletool尝试测试了不同的apk,发现了这一点:
“ App Bundle包含32位RenderScript位代码文件(.bc),它将在Android中禁用64位支持。”
我正在尝试使我的应用程序与新的PlayStore要求兼容64位。我们确实在应用程序中使用了RenderScript,所以我想知道这是否会引起问题?而且,如何解决这些问题?渲染脚本是一个非常小的脚本,它仅根据输入输出带有绿色或红色部分的位图。
#pragma version(1)
#pragma rs java_package_name(za.co.overtake)
int*reds;
int*greens;
int*blues;
int imgWidth;
uchar4 RS_KERNEL root(uchar4 in, uint32_t x, uint32_t y) {
bool colourme = false;
for(int col = 0; col < imgWidth; col++){
const int red = reds[col];
const int green = greens[col];
const int blue = blues[col];
if (in.r == red && in.g == green && in.b == blue){
colourme = true;
}
}
if (colourme) {
// Cannot increase red amount much as it will cause issues when capturing the image in 565
// format.
in.r = 100;
in.g = 10;
in.b = 10;
in.a = 100;
} else if (in.a > 200) {
in.r = 21;
in.g = 63;
in.b = 81;
in.a = 100;
} else {
in.r = 0;
in.g = 0;
in.b = 0;
in.a = 0;
}
return in;
}
Run Code Online (Sandbox Code Playgroud)
我们像这样在Java中调用此脚本:
final RenderScript rs = RenderScript.create(this);
final Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT | Allocation.USAGE_SHARED);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptC_singlesource script = new ScriptC_singlesource(rs);
Allocation red = Allocation.createSized(rs, Element.I32(rs), reds.length);
red.copyFrom(reds);
script.bind_reds(red);
Allocation green = Allocation.createSized(rs, Element.I32(rs), greens.length);
green.copyFrom(greens);
script.bind_greens(green);
Allocation blue = Allocation.createSized(rs, Element.I32(rs), blues.length);
blue.copyFrom(blues);
script.bind_blues(blue);
script.set_imgWidth(noOfColours);
script.forEach_root(input, output);
output.copyTo(bitmap);
RenderScript blur = RenderScript.create(this);
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(blur, Element.U8_4(blur));
Allocation tmpIn = Allocation.createFromBitmap(blur, bitmap);
Allocation tmpOut = Allocation.createFromBitmap(blur, bitmap);
theIntrinsic.setRadius(4.0f);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(bitmap);
Run Code Online (Sandbox Code Playgroud)
Android Developer文档指出,使用任何C或C ++代码都可能使您的应用程序不兼容。但是,我找不到专门针对RenderScript的解决方案。
好的,原来我必须做两件事:
使用较新版本的Renderscript。我将目标定为22,并将renderscriptSupportModeEnabled设置为true。另外,必须确保我使用的是android.support.v8.renderscript.RenderScript而不是android.Renderscript。
还原AndroidX。这是一个任务!由于某种原因,它不得不将androidX淘汰,因为它拒绝与Renderscript完美配合。例如,它将在Android5上崩溃,并且只是拒绝与64位兼容。
我希望这可以帮助某个人!
O,最后一个花絮:您可以使用bundletool测试捆绑软件是否兼容64位。我发现此站点非常有用:https : //www.raywenderlich.com/9043-android-app-bundles-getting-started
-它会告诉您是否无法构建64位apk。
更新:另一个发现!因此,按照所有这些步骤操作,您会注意到所有64位文件夹都在APK中生成。但是,如果您使用的外部库不具备全部64位要求,那么:GOOGLE不会采取任何措施!似乎仅检查文件夹是否存在,而不检查每个文件夹中所需的所有内容是否存在。即使使用x86_64缺少库的库,这也使我的渲染脚本项目“兼容”!(长话短说:我的其他项目不想与64位兼容,因此我最终将其跟踪到了库中,而不使用renderscript。我的解决方案是删除对x86的支持,因为我们所在的国家/地区没有该设备无论如何。)
| 归档时间: |
|
| 查看次数: |
530 次 |
| 最近记录: |