title: Android RenderScript development problems
body: <p>I am trying to run my first RenderScript application. Yet I am having the following problems:
  First are the error messages:</p>
  
  <p>Description Resource Path Location Type
  The constructor ScriptC_simplers(RenderScript, Resources, int) is undefined MainActivity.java      /SimpleRS/src/com/benchmark/simplers line 57 Java Problem</p>
  
  <p>The method forEach_root(Allocation, Allocation) in the type ScriptC_simplers is not applicable for     the arguments (Allocation, Allocation)   MainActivity.java   /SimpleRS/src/com/benchmark/simplers    line 60 Java Problem</p>
  
  <p>I am using Eclipse ADT, the API level is 19.1.0</p>
  
  <p>The R.java file and ScriptC_simplers.java have been successfully generated.
  Here is the MainActivity file:</p>
  
  <pre><code>package com.benchmark.simplers;
  
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.renderscript.Allocation;
  import android.renderscript.RenderScript;
  import android.renderscript.ScriptC;
  import android.widget.ImageView;
  
  import android.support.v8.renderscript.*;
  
  
  public class MainActivity extends Activity {
  private Bitmap mBitmapIn;
  private Bitmap mBitmapOut;
  
  
  private RenderScript mRS;
  private Allocation mInAllocation;
  private Allocation mOutAllocation;
  private ScriptC_simplers mScript;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mBitmapIn = loadBitmap(R.drawable.android);
      mBitmapOut = Bitmap.createBitmap(
      mBitmapIn.getWidth(), mBitmapIn.getHeight(), mBitmapIn.getConfig());
      ImageView in = (ImageView) findViewById(R.id.displayin);
      in.setImageBitmap(mBitmapIn);
  
  
      ImageView out = (ImageView) findViewById(R.id.displayout);
      out.setImageBitmap(mBitmapOut);
  
  
      createScript();
  }
  
  private void createScript() {
      mRS = RenderScript.create(this);
  
  
      mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
      Allocation.MipmapControl.MIPMAP_NONE,
      Allocation.USAGE_SCRIPT);
      mOutAllocation = Allocation.createTyped(mRS, mInAllocation.getType());
  
  
      mScript = new ScriptC_simplers(mRS, getResources(), R.raw.simplers);
  
  
      mScript.forEach_root(mInAllocation, mOutAllocation);
      mOutAllocation.copyTo(mBitmapOut);
  }
  
  private Bitmap loadBitmap(int resource) {
      final BitmapFactory.Options options = new BitmapFactory.Options();
      options.inPreferredConfig = Bitmap.Config.ARGB_8888;
      return BitmapFactory.decodeResource(getResources(), resource, options);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is simplers.rs file:</p>
  
  <pre><code>#pragma version(1)
  #pragma rs java_package_name(com.benchmark.simplers)
  
  
  const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
  
  
  void root(const uchar4 *v_in, uchar4 *v_out) {
      float4 f4 = rsUnpackColor8888(*v_in);
      float3 mono = dot(f4.rgb, gMonoMult);
      *v_out = rsPackColorTo8888(mono);
  }
  </code></pre>
  
  <p>In the generated file ScriptC_simplers.java, I can see the constructor:</p>
  
  <pre><code>public  ScriptC_simplers(RenderScript rs, Resources resources, int id) {
      super(rs, resources, id);
      __U8_4 = Element.U8_4(rs);
  }
  </code></pre>
  
  <p>I just do not know why ADT cannot find the constructor. If you know solutions, please help me, thank u!</p>