6

我已經更新了我與Android L移動應用程序,我有這個例外我不明白:NullPointerException異常:INT android.support.v4.app.FragmentManagerImpl.mCurState空對象引用

NullPointerException異常:試圖讀取來自'int android.support.v4.app.FragmentManagerImpl.mCurState'字段的空對象引用

有人可以幫我嗎?

中的build.gradle:

dependencies { 
    compile files('libs/libGoogleAnalyticsServices.jar') 
    compile 'com.android.support:support-v4:21.0.3' 
    compile 'com.android.support:appcompat-v7:21.0.3' 
    compile 'com.google.android.gms:play-services:6.5.87' 
} 

堆棧跟蹤:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lucagrillo.myapp/com.lucagrillo.myapp.MainActivity}: android.view.InflateException: Binary XML file line #23: Error inflating class fragment 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
    at android.app.ActivityThread.access$800(ActivityThread.java:144) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5221) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class fragment 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:511) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
    at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:229) 
    at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:103) 
    at com.lucagrillo.myapp.MainActivity.onCreate(MainActivity.java:153) 
    at android.app.Activity.performCreate(Activity.java:5933) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) 
    ... 10 more 
Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.support.v4.app.FragmentManagerImpl.mCurState' on a null object reference 
    at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2182) 
    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297) 
    at android.support.v7.app.ActionBarActivity.onCreateView(ActionBarActivity.java:547) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
    ... 20 more 

非常感謝你

+0

你有沒有找到一個解決方案? –

+0

Crosscheck您的XML文件。 – Lavakush

+0

1.請發佈您的代碼。 2.您是否已經在AndroidManifest.xml中正確定義了所有活動? 3.您是否嘗試在您的活動中啓動XML佈局中不存在的任何TextView,Button或其他佈局元素? – joshgoldeneagle

回答

0

您的問題可能是在動作條。但你也應該發佈你的XML文件和MainActivity,以便我們可以理解問題

相關問題