I can't reproduce your problem, perhaps something else is wrong.
Using the following application, I was able to create a file in the cache directory and then clear it using the Manage Applications function under Settings. I didn't have to change anything in the manifest and from what I can tell, you really shouldn't mess with the android:allowClearUserData
option.
public class CreateCacheFile extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.CreateFileButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(
CreateCacheFile.this.getCacheDir(), "temp.txt");
try {
file.createNewFile();
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("Hello World");
bw.newLine();
bw.close();
} catch (IOException e) {
Toast.makeText(
CreateCacheFile.this,
"Error!",
Toast.LENGTH_SHORT).show();
}
}
});
}
}
After running the application (and clicking the button to create the file):
$ adb -d shell
# ls /data/data/com.example.CreateCacheFile/cache
temp.txt
# cat /data/data/com.example.CreateCacheFile/cache/temp.txt
Hello World
#
Manage Applications reports that 4KB of space is in use for Cache. After clicking the button to clear it:
# ls /data/data/com.example.CreateCacheFile/cache
# cat /data/data/com.example.CreateCacheFile/cache/temp.txt
temp.txt: No such file or directory
#
At this point Manage Applications reports that 0KB of space is in use for Cache.