2013-03-10 53 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

相关问题