应用程序启动时应用程序类不运行?

问题描述:

我使用的应用程序类,但是当应用程序启动
这里它没有运行是我的代码:应用程序启动时应用程序类不运行?

在AndroidManifest.xml

<application 
    android:name=".App" 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

当我把一个断点里面的onCreate()和run

public class App extends Application { 
// 
private static final String TAG = App.class.getSimpleName(); 
public static SharedPreferences sPrefs; 
private static App sInstance; 

public static App getsInstance() { 
    return sInstance; 
} 

@Override 
public void onCreate() { 
    super.onCreate(); 
    if (!BuildConfig.DEBUG) { 
     Fabric.with(this, new Crashlytics()); 
    } 
    Log.e(TAG,"onCreate()"); 
    sInstance = this; 
    sPrefs = PreferenceManager.getDefaultSharedPreferences(this); 
} 
//some methods 
} 

一个调试它不会停止对它 任何帮助?

+0

但你看到日志吗? – Blundell

+0

不,我没有... – Tefa

+1

应用程序无法运行。如果您试图向用户显示内容,则需要进行一项活动。您可以尝试将应用程序类设置为启动器,但我怀疑它会起作用。 – BlackHatSamurai

尝试卸载应用程序,清理项目并重新安装。

+0

没有为我工作? :/ – Tefa

+0

你能否提供你的App类的包名? –

+0

它在我禁用即时运行时起作用,我认为IDE需要更新 – Tefa