RenderScript support library V8 fail to compile

霸气de小男生 提交于 2019-12-23 15:22:14

问题


My platform information OS: Windows 7 32 bit ADT version: Build: v22.2.1-833290 SDK Tools version: 22.2.1 SDK Built-tools version: 18.1

I was trying to get the new Renderscript support library v8 to work. I created an android application using API level 18 as the target SDK and compile SDK, API level 17 as the minimum required SDK. I then followed the steps in the following links to configure my project, http://android-developers.blogspot.hk/2013/09/renderscript-in-android-support-library.html , http://developer.android.com/guide/topics/renderscript/compute.html#access-rs-apis .

After I added

renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=18.1.0

into the file "project.properties", I added an empty .rs file into the src folder (under my package, just like usual). Then I received the following error message.

[2013-09-22 22:32:32 - aaaaa] <invalid>: error: missing pragma for version in source file
[2013-09-22 22:32:32 - aaaaa] <invalid>: error: missing "#pragma rs java_package_name(com.foo.bar)" in source file
[2013-09-22 22:32:32 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\arm-linux-androideabi-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\armeabi-v7a\test.o: attempt to map 40 bytes at offset 1616 exceeds size of file; the file may be corrupt
[2013-09-22 22:32:32 - aaaaa] C:\Users\rensijie\workspace\aaaaa\bin\rsObj\mips\test.o: file not recognized: File format not recognized
[2013-09-22 22:32:32 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test.o: section name section has wrong type: 2097152
[2013-09-22 22:32:32 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test.o: attempt to map 46661632 bytes at offset 0 exceeds size of file; the file may be corrupt

Since I understand the meaning of the first two error message, I added

#pragma version(1)
#pragma rs java_package_name(com.example.aaaaa)

to the file.

While the first two error message went away, the following error message appeared again and I can't get rid of it by adding/modifying the content of the script (e.g. I copied a previously working script and it won't work now). However, I observed that the corresponding .java script file in the gen folder was created properly (with import android.support.v8.renderscript.*; inside).

[2013-09-22 22:34:29 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\arm-linux-androideabi-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\armeabi-v7a\test.o: attempt to map 40 bytes at offset 1616 exceeds size of file; the file may be corrupt
[2013-09-22 22:34:30 - aaaaa] C:\Users\rensijie\workspace\aaaaa\bin\rsObj\mips\test.o: file not recognized: File format not recognized
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test.o: section name section has wrong type: 2097152
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test.o: attempt to map 46661632 bytes at offset 0 exceeds size of file; the file may be corrupt
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\arm-linux-androideabi-ld.exe: error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\armeabi-v7a\test2.o: section name section has wrong type: 469762048
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\arm-linux-androideabi-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\armeabi-v7a\test2.o: attempt to map 3103784960 bytes at offset 0 exceeds size of file; the file may be corrupt
[2013-09-22 22:34:30 - aaaaa] C:\Users\rensijie\workspace\aaaaa\bin\rsObj\mips\test2.o: file not recognized: File format not recognized
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test2.o: section name section has wrong type: 7168
[2013-09-22 22:34:30 - aaaaa] C:\Work\SDK\adt-bundle-windows-x86-20130917\sdk\build-tools\android-4.3\i686-linux-android-ld.exe: fatal error: C:\Users\rensijie\workspace\aaaaa\bin\rsObj\x86\test2.o: attempt to map 39168 bytes at offset 0 exceeds size of file; the file may be corrupt

In eclipse, there's a red cross on the project name, indicating there's something wrong in the project. If I try to run the application, eclipse will prompt "Your project contains error(s), please fix them before running your application". However, other than the error message I got, and the red cross on the project name, there's no error in any of the java file (no red crosses on the java files)


回答1:


This issue was addressed by people in Google very recently. See https://code.google.com/p/android/issues/detail?id=60327&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&start=200



来源:https://stackoverflow.com/questions/18945533/renderscript-support-library-v8-fail-to-compile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!