Android: Unable to instantiate activity / ClassNotFoundException

前端 未结 30 2818
粉色の甜心
粉色の甜心 2020-11-27 13:46

I recently published an app to the market and I\'m now getting an error by some user, the app presumably crashes right when it starts. Unfortunately I can\'t contact him dir

相关标签:
30条回答
  • 2020-11-27 14:25

    Saw the same error message after doing a simple upgrade of my app. Fixed it by doing this:

    Project->Build automatically OFF
    Project->Clean->Selcting my project
    

    Then I did a new export of my signed app, and it worked.

    0 讨论(0)
  • 2020-11-27 14:27

    Similar to Bobf Cali, I first saw this error after renaming my base package to change the "example" section. To fix it, I had to delete my gen and bin directories, clean the project, and rebuild.

    Note depending on what version of the eclipse android plugin you're using (if any), you may also have to update activity names in your AndroidManifest.xml

    0 讨论(0)
  • 2020-11-27 14:27

    You had renamed the package anytime? This normally happens if the package was renamed after creation. Following link should be helpfull in that case http://code.google.com/p/android/issues/detail?id=2824. If this is not the case,please post your complete manifest file.

    0 讨论(0)
  • 2020-11-27 14:28

    This happened to me when I refactored one of my package names and the refactor tool removed the leading "." from all of my activity names. so in the AndroidManifest.xml, I had to change android:name="MyActivity" to android:name=".MyActivity"

    hope this helps someone, I just wasted a bunch of time o

    0 讨论(0)
  • 2020-11-27 14:28

    This doesn't apply to the OP's question, but it did to mine and it took me quite some time to figure it out: when using the Google Maps API, make sure you've included the library declaration in the application manifest.

    For instance:

    public class MyActivity extends MapActivity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
        }
    
        @Override
        protected boolean isRouteDisplayed() {
            return false;
        }
    
    }
    

    In AndroidManifest.xml:

    <application>
        <uses-library android:name="com.google.android.maps" />
        <activity android:name="MyActivity" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    
    0 讨论(0)
  • 2020-11-27 14:28

    Check out this article: http://www.androidguys.com/2010/05/22/storing-apps-sd-froyo/ which explains the limitations of storing apps on SD cards. If your users have their SD card mounted by a computer, that might make the SoundMachine class invisible. And I wonder if the cp command fails (perja's attempt to fix) because it might change the ownership of the files such that the userid of the app and the ownership of the files don't match anymore.

    0 讨论(0)
提交回复
热议问题