Android application is not Runnning Error:Resources$NotFoundException: Resource ID #0x7f030004

0

I'm stuck between some unusual problem.My app was running properly but I did some changes and switch the workspace. Now if I run my project the application closes with "Force to close" dialog.

I couldn't understand my log cat error detail.

Edit:

R File:

   public static final int main=0x7f030004;

Java Code:

public class AlphaKidsActivity extends Activity implements OnClickListener{

MediaPlayer mp1;
MediaPlayer mp2;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
   mp1 = MediaPlayer.create(this, R.raw.a);
   mp2 = MediaPlayer.create(this, R.raw.sound3);

  final Button button1 = (Button) findViewById(R.id.birds);
   button1.setOnClickListener(this);

   final Button button2 = (Button) findViewById(R.id.button2);
    button2.setOnClickListener(this);

}

@Override 
public void onClick(View v) {
    switch(v.getId()) {
    case R.id.birds:
        mp1.start();
        startActivity (new Intent(getApplicationContext(), FruitsActivity.class));
        break; 
    case R.id.button2: 
        mp2.start();
        startActivity (new Intent(getApplicationContext(), BirdsActivity.class));
        break; 
    }
}

@Override
protected void onDestroy() {
    mp1.release();
    mp2.release();
    super.onDestroy();
}

}

Log cat detail:

07-13 09:29:43.263: INFO/ActivityManager(59): Start proc com.android.mds.kidsapps.alphakids for activity com.android.mds.kidsapps.alphakids/.AlphaKidsActivity: pid=234 uid=10031 gids={}
07-13 09:29:43.691: DEBUG/ddm-heap(234): Got feature list request
07-13 09:29:44.162: WARN/ResourceType(234): getEntry failing because entryIndex 4 is beyond  type entryCount 1
07-13 09:29:44.162: WARN/ResourceType(234): Failure getting entry for 0x7f030004 (t=2 e=4) in package 0: 0x80000001


07-13 09:29:44.212: ERROR/AndroidRuntime(234): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mds.kidsapps.alphakids/com.android.mds.kidsapps.alphakids.AlphaKidsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030004
07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.os.Handler.dispatchMessage(Handler.java:99)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.os.Looper.loop(Looper.java:123)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at java.lang.reflect.Method.invokeNative(Native Method)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at java.lang.reflect.Method.invoke(Method.java:521)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at dalvik.system.NativeStart.main(Native Method)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030004
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.content.res.Resources.getValue(Resources.java:891)
  07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.content.res.Resources.loadXmlResourceParser(Resources.java:1865)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.content.res.Resources.getLayout(Resources.java:730)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.Activity.setContentView(Activity.java:1622)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at com.android.mds.kidsapps.alphakids.AlphaKidsActivity.onCreate(AlphaKidsActivity.java:19)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 07-13 09:29:44.212: ERROR/AndroidRuntime(234):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
android
exception
asked on Stack Overflow Jul 13, 2011 by vnshetty • edited Jul 13, 2011 by vnshetty

2 Answers

1

Check whether R.java file generated or not in your project under gen directive or some times the problem occurs "import android.R". If you find "import android.R;" in your class just remove it.

answered on Stack Overflow Jul 13, 2011 by sunriser
0

This can cause due to missing image in the drawable

answered on Stack Overflow Jul 13, 2011 by droid kid

User contributions licensed under CC BY-SA 3.0