I had an application published and running on Google Play for several months.
Today I received an error message from a user with an incomprehensible resource exception. I thought I might have forgotten about some available. From the error, I got the identifier of the object (I took it ID 0x7f030003
from the error) and looked for it in R.java to determine which object was missing.
To my surprise, I found that IDis is from my main activity, so I'm sure I have not forgotten about it!
My application starts with the main one and all other actions / fragments are called from it. When I return, I will just finish the open actions and return to Main. Thus, I did not receive an explicit Main call from the mailbox, so I lost what caused this. I can not reproduce it and have only a report from the user.
Am I mistaken in finding a resource? what can happen? heres is the error I get through the console
java.lang.RuntimeException: Unable to start activity
> ComponentInfo{com.myapp/com.myapp.MainActivity}:
> android.content.res.Resources$NotFoundException: Resource ID
>
> at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
> at android.app.ActivityThread.access$2300(ActivityThread.java:125) at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
> at android.os.Handler.dispatchMessage(Handler.java:99) at
> android.os.Looper.loop(Looper.java:123) at
> android.app.ActivityThread.main(ActivityThread.java:4627) at
> java.lang.reflect.Method.invokeNative(Native Method) at
> java.lang.reflect.Method.invoke(Method.java:521) at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) at
> dalvik.system.NativeStart.main(Native Method) Caused by:
> android.content.res.Resources$NotFoundException: Resource ID
>
> android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
> at android.content.res.Resources.getLayout(Resources.java:731) at
> android.view.LayoutInflater.inflate(LayoutInflater.java:318) at
> android.view.LayoutInflater.inflate(LayoutInflater.java:276) at
> com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
> at android.app.Activity.setContentView(Activity.java:1647) at
> com.myapp.MainActivity.onCreate(MainActivity.java:48) at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
> at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
> ... 11 more
This is my main oncreate ().
, . , , .
, .
MyApp , "inicializado" null, . ,
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
splashProgress = (ProgressBar) findViewById(R.id.mainSplash_pb_progressBar);
splashDescProgress = (TextView) findViewById(R.id.mainSplash_tv_descProgreso);
PACKAGE_NAME = MyApp.getContext().getPackageName();
media_btnClick = MediaPlayer.create(this, R.raw.btn_click);
if (savedInstanceState == null) {
TextView mi_textView = (TextView) findViewById(R.id.main_tv_Version);
PackageInfo mi_packageInfo = null;
try {
mi_packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
mi_textView.setText("v" + mi_packageInfo.versionName);
PACKAGE_CODE = mi_packageInfo.versionCode;
} catch (NameNotFoundException e) {
}
savedInstanceStateNull = true;
} else {
savedInstanceStateNull = false;
}
if (!MyApp.Inicializado) {
cargarDatosSplash();
Timer timer = new Timer();
timer.schedule(new LanzarInicio(), 10);
} else {
LinearLayout layoutSplash = (LinearLayout) findViewById(R.id.main_splash);
LinearLayout layoutMain = (LinearLayout) findViewById(R.id.main_menu);
layoutSplash.setVisibility(View.GONE);
layoutMain.setVisibility(View.VISIBLE);
}
}
class LanzarInicio extends TimerTask {
public void run() {
MainActivity.this.runOnUiThread(new Runnable() {
public void run() {
new cargarObjetosTask().execute();
}
});
}
}