R.java was modified manually! Reverting to generated version! 为啥会这样啊

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R.java was modified manually! Reverting to generated version! 为啥会这样啊相关的知识,希望对你有一定的参考价值。

package com.example.eatingsnake;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Snake extends Activity
private SnakeView mSnakeView;

private static String ICICLE_KEY="snake-view";
/**
* 在Activity类被调用时首先被创建,关闭标题栏,设置视图内容,激活视图页面
*/
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(com.example.eatingsnake.R.layout.snake_layout);
mSnakeView = (SnakeView) findViewById(com.example.eatingsnake.R.id.snake);
mSnakeView.setTextView((TextView) findViewById(com.example.eatingsnake.R.id.text));
if(savedInstanceState == null)
//如果视图状态为空,创建一个新视图并设置为准备状态
mSnakeView.setMode(SnakeView.READY);
else
//获取资源的信息
Bundle map = savedInstanceState.getBundle(ICICLE_KEY);
if(map != null)
(mSnakeView).restoreState(map);

else
mSnakeView.setMode(SnakeView.PAUSE);




protected void onPause()
super.onPause();
//暂停的操作
mSnakeView.setMode(SnakeView.PAUSE);

public void onSavedInstanceState(Bundle outState)
//存储游戏状态
outState.putBundle(ICICLE_KEY, mSnakeView.saveState());


R.id.text那几个一直有问题,什么原因呢

参考技术A http://blog.csdn.net/zhufuing/article/details/22228207

Unity3D 问题总结Unity报错提示:InvalidOperationException: Collection was modified; enumeration operation ma(代

前言

在Unity中运行场景时报错,报错内容如下


原因是在foreach中不能修改处理的集合,Foreach体内运用了对Collection的Remove方法(或者Add方法)

比如下面这种

foreach (string item in StudentList)
        
            items.Add(item);//不可操作
            items.Remove(item);//不可操作
        

解决办法

如果遍历时涉及增删操作,则使用for循环

上面的例子改为:

     for (int j=0;j< StudentList.Count;j++)
            
                StudentList.Add("");
                StudentList.Remove("");
            

以上是关于R.java was modified manually! Reverting to generated version! 为啥会这样啊的主要内容,如果未能解决你的问题,请参考以下文章

The parent virtual disk has been modified since the child was created

Unity3D 问题总结Unity报错提示:InvalidOperationException: Collection was modified; enumeration operation ma(代

Unity3D 问题总结Unity报错提示:InvalidOperationException: Collection was modified; enumeration operation ma(代

was控制台英文改成中文

xcode 报错 malloc: *** error for object 0x6c3c5a4: incorrect checksum for freed object - object was pr

was服务无法保持会话