7

I try to run Renderscript example HelloCompute on Android 2.3.5.

( I use v22.2.1-833290 and SDK 22.2.1 I got an error message from Logcat:

W/dalvikvm( 4928): VFY: unable to resolve static method 412: Landroid/renderscript  /RenderScript;.create (Landroid/content/Context;)Landroid/renderscript/RenderScript;  
W/dalvikvm( 4928): threadid=1: thread exiting with uncaught exception (group=0x4002d560)  
E/AndroidRuntime( 4928): FATAL EXCEPTION: main  
E/AndroidRuntime( 4928): java.lang.NoSuchMethodError:   android.renderscript.RenderScript.create  

In order to make apk package, I added Android Support library v13 into build step.

I guess that renderscript library was not added correctly into build step. Sorry I could not find Android Support Library v8 as following post http://android-developers.blogspot.com/2013/09/renderscript-in-android-support-library.html

How can overcome this issue ?

David
  • 15,894
  • 22
  • 55
  • 66
vonbk
  • 175
  • 1
  • 2
  • 3
  • 1
    I have the same problem. Eclipse shows "android.support.v8.renderscript" cannot be resolved error. – Sam Lu Sep 24 '13 at 04:56
  • 1
    Same problem here. Can't resolve it.. – sweggersen Sep 29 '13 at 20:51
  • Same problem here. Followed http://developer.android.com/guide/topics/renderscript/compute.html#access-rs-apis to the letter but to no avail. I'm using ADT v22.2.1-833290 as well, which I'm running on Mac OSX. – reor Oct 24 '13 at 22:01
  • I have added a request for help to the Android Developers Google Group here: https://groups.google.com/forum/?hl=en#!topic/android-developers/11HUoezkR2M . We'll see how long it takes to find the answer. – reor Oct 29 '13 at 14:49

7 Answers7

4

Take a look at /build-tools/18.1.0/lib/renderscript-v8.jar

hector6872
  • 1,336
  • 14
  • 18
  • Thanks your pointing out. For my case: It seems that I found jar file in different directory build-tools/android-4.3/renderscript/lib/renderscript-v8.jar. But I faced another problem. Following is logcat: //------------------ Below ------------------ W/dalvikvm(19423): Unable to resolve superclass of Landroid/support/v8/renderscript/RenderScript$2; (122) W/dalvikvm(19423): Link of class 'Landroid/support/v8/renderscript/RenderScript$2;' failed TO be continued – vonbk Sep 26 '13 at 16:50
  • E/dalvikvm(19423): Could not find class 'android.support.v8.renderscript.RenderScript$2', referenced from method android.support.v8.renderscript.RenderScript.setErrorHandler W/dalvikvm(19423): VFY: unable to resolve new-instance 645 (Landroid/support/v8/renderscript/RenderScript$2;) in Landroid/support/v8/renderscript/RenderScript; ... //------------------ Above ------------------ Android is new for me. Therefore, I'm not able to debug it. – vonbk Sep 26 '13 at 16:51
  • Which IDE do you use? – hector6872 Sep 27 '13 at 17:02
  • I use ADT v22.1 (Eclipse) Error message in previous post is Logcat. – vonbk Sep 29 '13 at 07:40
  • I meant: do you use IDEA, Eclipse or Android Studio? – hector6872 Oct 01 '13 at 13:05
  • He answered your question. He's using Eclipse. And so am I, and having the same problem. Query, vonbk: Using ADT v22.1 on Mac OSX? – reor Oct 24 '13 at 21:59
3

I suffer a similar problem, but finally resolved.

my experience :

I refer to this link-> http://www.doubleencore.com/2013/10/renderscript-for-all/ to import android.support.v8.renderscript.

then encountering an error->

  VFY: unable to resolve static method 106: Landroid/support/v8/renderscript/RenderScript; create (Landroid / content / Context ;) Landroid/support/v8/renderscript/RenderScript;.

Finally found my mistakes,I forget to enable the jar at "Order and Export" of "Java Build Path" .

After enable the jar, my app can finally work.

hope my experience can help anyone. :)

2

The v13 support library is for Honeycomb, you need the v8 support library. You also have to reference android.support.v8.renderscript, not android.renderscript.

Lesleh
  • 1,665
  • 15
  • 24
  • Thanks for your reply. I modified as follows: **import android.renderscript** -> **import android.support.*** Since there is no **android support library v8** under the directory **android/sdk/extras/android/support** ( available libraries are v4,v7,v13) Do you know where I can get **prebuilt jar** file of **android support library v8** – vonbk Sep 22 '13 at 16:52
  • Have you installed the SDK build-tools v18.1 through the SDK manager? Follow the instructions here - http://developer.android.com/guide/topics/renderscript/compute.html#access-rs-apis – Lesleh Sep 22 '13 at 18:30
  • Yes, I followed the instruction as following address http://developer.android.com/guide/topics/renderscript/compute.html#access-rs-apis And I installed "Android Support Library" with SDK Manager by selecting "Extras/Android Support Library" checkbox. But there was no "Android Support Library v8" under "android/sdk/extras/android/support" directory after installation had finished ( available directory are only v4,v7,v13) as I said before. – vonbk Sep 23 '13 at 09:40
1

add this line into your .classpath:

<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-support-v8-renderscript_intermediates/javalib.jar"/>

Alternatively, Build Path -> Configure Build Path -> Libraries -> Add JARs -> add "out/target/common/obj/JAVA_LIBRARIES/android-support-v8-renderscript_intermediates/javalib.jar"

Achal Dave
  • 4,079
  • 3
  • 26
  • 32
1

From here:

In your project.properties, make sure you’re targeting android-18 and add the following lines:

renderscript.target=18

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

Now clean the project. You should see renderscript-v8.jar added to your Android Dependenmcies.

Community
  • 1
  • 1
Vaiden
  • 15,728
  • 7
  • 61
  • 91
1

I was getting this error:

E/AndroidRuntime(12762): Caused by: java.lang.NoSuchMethodError: no static or non-static method "Landroid/support/v8/renderscript/RenderScript;.nDeviceSetConfig(JII)V"

I needed to have this in my build.gradle

renderscriptTargetApi 22
renderscriptSupportModeEnabled true

And then needed to add this to my custom proguard rules for release builds

# Renderscript support library
-keep class android.support.v8.renderscript.** { *; }
Scott B
  • 1,478
  • 2
  • 16
  • 26
0

Just Copy /build-tools/24.0.3/renderscript/lib/renderscript-v8.jar to your project libs folder and add this to your dependencies compile fileTree(dir: 'libs', include: ['*.jar']) This worked for me, hope it helps you too.

essayoub
  • 713
  • 2
  • 8
  • 14