我刚刚在
Android Studio中启动了renderscript.当我创建.rs文件时,不会生成ScriptC_DS类和.bc文件.我已经读过,一旦.rs文件被保存,它应该是自动生成的,所以我不确定出了什么问题.
DS.rs
#pragma version(1)
#pragma rs java_package_name(com.example.DSing)
void root(){
}
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.DSing"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
renderscriptTargetApi 18
renderscriptSupportMode true
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
MainActivity类目前没有任何内容(除了自动生成的默认值),但是当我尝试在内部创建私有ScriptC_DS时,我收到一条消息“无法解析符号ScriptC_DS”.
主要活动
package com.example.DSing
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v8.renderscript.*;
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
private ScriptC_DS test;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
问题:我做错了什么?