我在学校的一个程序上工作,但当我尝试在家里的电脑上启动它时,我得到了这个错误(我在usb上复制了项目):
02-08 14:41:57.212 1672-1672/sia.school.sia14_15 E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{sia.school.sia14_15/sia.school.sia14_15.SIA_tabbedActivity}: android.content.res.Resources$NotFoundException: String array resource ID #0x7f050003
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String array resource ID #0x7f050003
at android.content.res.Resources.getStringArray(Resources.java:450)
at sia.homag.sia14_15.SIA_tabbedActivity.onCreate(SIA_tabbedActivity.java:51)
R档案:
public final class R {
public static final class anim {
public static final int abc_fade_in=0x7f040000;
public static final int abc_fade_out=0x7f040001;
public static final int abc_slide_in_bottom=0x7f040002;
public static final int abc_slide_in_top=0x7f040003;
public static final int abc_slide_out_bottom=0x7f040004;
public static final int abc_slide_out_top=0x7f040005;
}
public static final class array {
public static final int a_9083646153=0x7f050002;
public static final int agregat_xy=0x7f050000;
public static final int b_9083646153=0x7f050003; //yes, the names do have some meaning
}
/*...*/
SIA_tabbedAvtivity:
public class SIA_tabbedActivity extends ActionBarActivity
{
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
SectionsPagerAdapter mSectionsPagerAdapter;
private String[] strArray;
private String scanResult; // Speichert das Ergebnis des Barcodescanns
/**
* The {@link ViewPager} that will host the section contents.
*/
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
/*Error -> */ strArray = getResources().getStringArray(R.array.b_9083646153);
setContentView(R.layout.activity_sia_tabbed);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
} /*...*/
它在学校运作良好。我已经尝试清理并重建项目并删除了R文件以重新生成它但没有任何效果。是的,.xml中有一个字符串数组,名称正确。