2013-10-03 101 views
7

我得到一個錯誤,在我的logcat中指出:致命異常:主要java.lang.NoClassDefFoundError:com.google.analytics.tracking.android.EasyTracker

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.analytics.tracking.android.EasyTracker 

上線EasyTracker.getInstance(this).activityStart(this);

有沒有人看過這個或知道如何解決它?

的logcat:

10-03 15:22:11.462: W/dalvikvm(10808): VFY: unable to resolve static method 100: Lcom/google/analytics/tracking/android/EasyTracker;.getInstance (Landroid/content/Context;)Lcom/google/analytics/tracking/android/EasyTracker; 
10-03 15:22:11.942: I/System.out(10808): Sim State5 
10-03 15:22:12.022: W/dalvikvm(10808): threadid=1: thread exiting with uncaught exception (group=0x40ad41f8) 
10-03 15:22:12.032: E/AndroidRuntime(10808): FATAL EXCEPTION: main 
10-03 15:22:12.032: E/AndroidRuntime(10808): java.lang.NoClassDefFoundError: com.google.analytics.tracking.android.EasyTracker 
10-03 15:22:12.032: E/AndroidRuntime(10808): at com.tf.st.stdatasettings.StartActivity.onCreate(StartActivity.java:75) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.Activity.performCreate(Activity.java:4471) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1924) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.ActivityThread.access$600(ActivityThread.java:123) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.os.Handler.dispatchMessage(Handler.java:99) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.os.Looper.loop(Looper.java:137) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at android.app.ActivityThread.main(ActivityThread.java:4429) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at java.lang.reflect.Method.invokeNative(Native Method) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at java.lang.reflect.Method.invoke(Method.java:511) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558) 
10-03 15:22:12.032: E/AndroidRuntime(10808): at dalvik.system.NativeStart.main(Native Method) 

來源:

@SuppressWarnings("unused") 
public class StartActivity extends Activity { 

    private AnimationDrawable mGoButtonAnimation; 
    Context c; 
    boolean isAirPlaneMode; 
    int simState; 
    TelephonyManager tm; 
    boolean NetworkConnection = false; 
    AlertDialog mConfirmAlert = null; 
    //GoogleAnalyticsTracker tracker; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.start); 
     tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 
     simState = tm.getSimState(); 
     System.out.println("Sim State" + simState); 
     Button goButton = (Button) findViewById(R.id.go_button); 
     goButton.setBackgroundResource(R.drawable.go_button_animation); 
     mGoButtonAnimation = (AnimationDrawable) goButton.getBackground(); 


     EasyTracker.getInstance(this).activityStart(this); 

回答

11

這是一個常見的相關性錯誤,確保包含在例外中指定的類的JAR實際上是正確的在你的Java構建路徑鏈接(右鍵單擊項目 - >屬性 - > Java Build Path)。還要確保如果你正在使用一個庫項目,其中包含的類正在被導出,在Java Build Path屏幕上轉到Libraries/Order And Export,並仔細檢查它們是否被正確配置,並且你沒有丟失包含類。

希望這會有所幫助。

問候!

+0

這幫了我很多。尤其要確保在「訂單和導出」選項卡上選中庫。我還發現,要應用新的設置,我需要在重新啓動之前清理主項目。 –

+0

我怎麼可以在android工作室? –