2016-12-30 130 views
1

我使用的應用程序類,但是當應用程序啓動
這裏它沒有運行是我的代碼:應用程序啓動時應用程序類不運行?

在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

嘗試卸載應用程序,清理項目並重新安裝。

+0

沒有爲我工作? :/ – Tefa

+0

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

+0

它在我禁用即時運行時起作用,我認爲IDE需要更新 – Tefa

相關問題