title: ClassNotFoundException on serializable class during activity start
body: <p><strong>The Setup</strong></p>
  
  <p>I have an activity that only overrides onCreate(), onResume(), and onSaveInstanceState(). In onSaveInstanceState(), I put in a serializable object:</p>
  
  <pre><code>    @Override 
      public void onSaveInstanceState(Bundle state) {
          super.onSaveInstanceState(state);
          state.putSerializable("obj", myObj); // myObj is of class MyClass               state.putLong("long", longVar);
      }
  </code></pre>
  
  <p>MyClass was originally an inner class inside the activity class, but for debugging, I even moved it to a separate file:</p>
  
  <pre><code>public class MyClass implements Serializable {
      private static final long serialVersionUID = 0x98ED2F00;
       ....
  }
  </code></pre>
  
  <p><strong>The Steps:</strong></p>
  
  <ol>
  <li>Start the program in the usual way, it runs fine.</li>
  <li>Click Home button to go back to the Launcher.</li>
  <li>From Eclipse, stop the process from the Device panel</li>
  <li><p>Start the program again from Launcher, this time I get the following:</p>
  
  <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.Reports}: java.lang.RuntimeException Parcelable encountered ClassNotFoundException reading a serializable object {name = com.example.MyClass}</p>
  
  <p>Caused by: java.lang.ClassNotFoundException: com.examp.MyClass in loader dalvik.System.PathClassLoader[.]</p></li>
  </ol>
  
  <p><strong>Clues and Observations:</strong></p>
  
  <ol>
  <li><p>The most important clue is: if I don't save myObj in onSaveInstanceState(), then everything is fine. And, putting any primitive types into the Bundle is fine, but not my objects.</p></li>
  <li><p>The exception is thrown outside of my code, it happened between onCreate() and onResume(). It happened inside Android.</p></li>
  <li><p>The class name in the error message is correct: com.example.MyClass. Originally it was an inner class inside the activity, but to isolate the problem, I moved it to a separate file, to no avail.</p></li>
  <li><p>I believe the implementation of Serializable is correct, because it can be serialized to/from a file in other parts of the program.</p></li>
  </ol>
  
  <p>Does anybody have an idea of any possible cause of this? Much appreciated! (Sorry I can't put detailed code here, because everything is intertwined here and there. I can only isolate as much as possible.)</p>