Question

I have this problem when trying to launch my app, it's strange because yesterday it was working fine.

01-18 12:19:40.192: E/AndroidRuntime(1530): FATAL EXCEPTION: main
01-18 12:19:40.192: E/AndroidRuntime(1530): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pe.com.livetrack.client/pe.com.livetrack.client.activities.BootSherlockFragmentActivity}: java.lang.ClassNotFoundException: pe.com.livetrack.client.activities.BootSherlockFragmentActivity in loader dalvik.system.PathClassLoader[/data/app/pe.com.livetrack.client-1.apk]
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2603)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2697)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread.access$2300(ActivityThread.java:126)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2051)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.os.Looper.loop(Looper.java:123)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread.main(ActivityThread.java:4645)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at java.lang.reflect.Method.invokeNative(Native Method)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at java.lang.reflect.Method.invoke(Method.java:521)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at dalvik.system.NativeStart.main(Native Method)
01-18 12:19:40.192: E/AndroidRuntime(1530): Caused by: java.lang.ClassNotFoundException: pe.com.livetrack.client.activities.BootSherlockFragmentActivity in loader dalvik.system.PathClassLoader[/data/app/pe.com.livetrack.client-1.apk]
01-18 12:19:40.192: E/AndroidRuntime(1530):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
01-18 12:19:40.192: E/AndroidRuntime(1530):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2595)
01-18 12:19:40.192: E/AndroidRuntime(1530):     ... 11 more

Things I have done trying to make it works:

  1. Clean and build project
  2. Clean and build ActionbarSherlock project
  3. Chechk the Manifest for the activity and it is registered.
  4. Check the bin library for the class and the class is there.

AndroidManifest.xml

 <activity android:name="pe.com.livetrack.client.activities.BootSherlockFragmentActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:exported="true"
        android:label="@string/app_name"
        android:screenOrientation="unspecified" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

BootFragment

public class BootSherlockFragmentActivity extends SherlockFragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);     
        IOController ioController = new IOController(getApplicationContext());
        UserData userData = ioController.loadUserData();
        if (!(userData.getAccount().equals("") && userData.getUser().equals(""))) {
            startActivity(new Intent(getApplicationContext(),
                    MainMenuSherlockActivity.class));
            finish();
        } else {
            setContentView(R.layout.boot);

            TextView textViewVersion = (TextView) findViewById(R.id.boot_textview_version);
        try {
            String versionName = getPackageManager().getPackageInfo(
                    getPackageName(), 0).versionName;
            textViewVersion.setText(textViewVersion.getText() + " "
                    + versionName);
        } catch (NameNotFoundException e) {
            textViewVersion.setText("");
        }

        new LoadUserDataAndGoToMainMenu(this).execute();
    }

}

Also I have the libraries referenced

Libraries

The Java Build Path here:

Java Build path

Any idea what can I do?

I re-reference the actionBarSherlock library and it works, I modified the files project.properties , .classpath and other files with a text editor (Notepad++) and it worked with 5 projects that I was getting the same error, but with one didn't work. Now I am getting this error:

[2014-01-21 18:19:41 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2014-01-21 18:19:41 - MyApp] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

If I clean and build the project or try to modify the files with the editor but I get the above error ClassNotFoundException.
What is wrong?

Was it helpful?

Solution

The solution was deleting the android-support-v4.jar from the ActionBarSherlock project, build the ABS project again, re-referencing, clean the project and build it again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top