2013-03-10 32 views
2

我有一個奇怪的問題。我的應用程序類onCreate(或onReusume)永遠不會被調用。即使我卸載應用程序並調試agan。 這是我的代碼。我找不到任何奇怪的東西。如果我設置了一個breaktpoint,它永遠不會到達,其他類告訴我init初始化失敗。 坦克onCreate in main class extends應用程序從未調用過

package com.MyApp; 

import org.acra.*; 
import org.acra.annotation.*; 
import android.app.Application; 


@ReportsCrashes(formKey = ".................") 
public class MyApp extends Application { 


    @Override 
    public void onConfigurationChanged(Configuration newConfig) { 
     super.onConfigurationChanged(newConfig); 
    } 



    public void onCreate() { 
     // The following line triggers the initialization of ACRA 
     if (!BuildConfig.DEBUG) { 
      ACRA.init(this); 
     } 

這是我的xml:

<application 
     android:name="com.MyApp.MyApp" 
     android:icon="@drawable/icon" 
     android:label="@string/app_name" 
     android:theme="@style/Theme" > 
     <activity android:name="com.MyApp.MyApp.MainActivity" > 
      <intent-filter> ... 

回答

4

改變這一點,將工作

@Override 
    public void onCreate() { 
    // The following line triggers the initialization of ACRA 
    ACRA.init(this); 
    super.onCreate(); 
    } 

你忘記打電話給super.onCreate();

+0

super.oncreate後話在我的代碼。我之前沒有運氣的話有一個重寫。事情是我有一個線斷點上if(!BuildConfig.DEBUG){哪個corse永遠不會被調用。感謝您的回覆 – user1324936 2013-03-10 20:37:24

相關問題