你好,所以我正在使用android工作室制作一个应用程序,这已经发生了很多,但我已经能够修复它。所以有时(不经常,但他们仍然发生),我正在编辑一个页面的xml,或者我在java文件中添加一些东西,当我运行我的代码(使用Android studio而不是Eclipse),然后突然我的r类文件被删除在我自己的眼睛。(就像我在运行代码时观察层次结构一样,文件就这样消失了。)通常我已经通过复制和粘贴我的r .类文件从备份我保留,但这一次我试过了,它一直在删除它。我不知道哪里出了问题,但请帮帮我。谢谢你
(PS)在我的所有活动预览中,一切都很好,没有红线表示错误。当我从我的绘图中添加图像时,我认为这个问题开始了。)
每个请求的Logcat错误:
07-12 16:44:50.872 183-183/? E/﹕ invalid crash request of size 4 (from pid=26208 uid=0)
07-12 16:44:51.143 26801-26801/? E/Diag_Lib﹕ Diag_LSM_Init: Failed to open handle to diag driver, error = 2
07-12 16:44:51.143 26801-26801/? E/Sensors﹕ sns_fsa_la.c(386):fsa: fflush failed, 9
07-12 16:44:51.144 26801-26801/? E/Sensors﹕ sns_fsa_la.c(386):fsa: fflush failed, 9
07-12 16:44:51.224 26801-26807/? E/Sensors﹕ sns_debug_main.c(565):Debug Config File missing in EFS!
07-12 16:46:26.463 183-183/? E/﹕ invalid crash request of size 4 (from pid=26801 uid=0)
07-12 16:46:26.764 27476-27476/? E/Diag_Lib﹕ Diag_LSM_Init: Failed to open handle to diag driver, error = 2
07-12 16:46:26.764 27476-27476/? E/Sensors﹕ sns_fsa_la.c(386):fsa: fflush failed, 9
07-12 16:46:26.765 27476-27476/? E/Sensors﹕ sns_fsa_la.c(386):fsa: fflush failed, 9
07-12 16:46:26.898 27476-27482/? E/Sensors﹕ sns_debug_main.c(565):Debug Config File missing in EFS!
消息说
Execution failed for task ‘:app:processDebugResources’.
>com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Users/…(my file path)../Android/sdk/build-tools/22.0.1/aapt” finished with non-zero exit value 1
我的一些xml调用image:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context="org.example.sudoku.MMW"
android:id="@+id/mm_w"
android:background="@color/background">
<TextView android:text="@string/mmw_info" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView7"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/manip"/>
</RelativeLayout>
对应Java: package org.example.sudoku;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MMW extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mmw);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mmw, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
决不,我的意思是决不决不复制或粘贴到r.java文件。这种情况发生时,他们是问题与您的xml是正常的,没有什么可担心的。为了解决这个问题,并构建项目一次,它会告诉你错误修复这个错误,r.j java是android创建的一个文件是android以十六进制格式创建的所有视图的引用