2
我是一個真正的設備上運行在Android 4.2.2 makeGooglePlayServicesAvailable,它只是與下面的堆棧跟蹤崩潰。我不知道這是一個makeGooglePlayServicesAvailable問題或更多的東西從錯誤信息?這個相同的代碼在Android OS較高的模擬器上工作正常。makeGooglePlayServicesAvailable崩潰的實際設備應用與Android工作室
public class EventsActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int success = googleApiAvailability.isGooglePlayServicesAvailable(this);
if(success != ConnectionResult.SUCCESS)
{
googleApiAvailability.makeGooglePlayServicesAvailable(this);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.drawer);
}
錯誤
Process: com.exposure, PID: 5713
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.EventsActivity}: java.lang.IllegalStateException: Activity has been destroyed
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Activity has been destroyed
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1560)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:696)
at android.support.v4.app.BackStackRecord.commitAllowingStateLoss(BackStackRecord.java:667)
at com.google.android.gms.internal.zzabm.zza(Unknown Source)
at com.google.android.gms.internal.zzaaw.zzc(Unknown Source)
at com.google.android.gms.internal.zzaaw.zzs(Unknown Source)
at com.google.android.gms.internal.zzabb.zzu(Unknown Source)
at com.google.android.gms.common.GoogleApiAvailability.makeGooglePlayServicesAvailable(Unknown Source)
的problm是您從破壞活動調用它。不僅如此,我們不能說沒有代碼。 –
添加的代碼,正如我所說的啓動和不破壞任何東西。 –
嘗試super.onCreate後稱之爲()。在這之前,Activity並沒有真正初始化。 –