无法使用Sherlock操作栏启动应用程序

时间:2014-01-18 17:42:21

标签: android actionbarsherlock dalvik dex

我在尝试启动我的应用时出现此问题,这很奇怪,因为昨天它工作正常。

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

我努力使其成功的事情:

  1. 清理并构建项目
  2. 清理并构建ActionbarSherlock项目
  3. Chechk the Manifest for the activity并且已注册。
  4. 检查bin库中的类,并且该类就在那里。
  5. 的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();
        }
    
    }
    

    我也引用了库

    Libraries

    这里的Java Build Path:

    Java Build path

    知道我该怎么办?

    我重新引用actionBarSherlock库并且它工作,我用文本编辑器(Notepad ++)修改了文件project.properties,.classpath和其他文件,并且它与5个项目一起工作,我得到了同样的错误,但是一个人没有工作。现在我收到了这个错误:

    [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;
    

    如果我清理并构建项目或尝试使用编辑器修改文件但我得到上述错误ClassNotFoundException。
    有什么问题?

1 个答案:

答案 0 :(得分:0)

解决方案是从ActionBarSherlock项目中删除android-support-v4.jar,再次构建ABS项目,重新引用,清理项目并再次构建它。