Performing hot restart...
Syncing files to device DRA LX5...
I/zygote (16775): Background concurrent copying GC freed 71653(2MB) AllocSpace objects, 0(0B) LOS objects, 50% free, 2MB/5MB, paused 383us total 544.321ms
I/zygote (16775): Background concurrent copying GC freed 74796(2MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/5MB, paused 719us total 249.256ms
Restarted application in 9 826ms.
W/DynamiteModule(16775): Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseAuth(16775): [FirebaseAuth:] Preparing to create service connection to gms implementation
W/DynamiteModule(16775): Local module descriptor class for providerinstaller not found.
I/DynamiteModule(16775): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller(16775): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
W/System (16775): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(16775): e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaHttp
I/flutter (16775): 3
I/flutter (16775): 0
I/zygote (16775): Background concurrent copying GC freed 71715(2MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/5MB, paused 474us total 201.963ms
I/zygote (16775): Background concurrent copying GC freed 69266(2MB) AllocSpace objects, 1(20KB) LOS objects, 50% free, 2MB/5MB, paused 237us total 106.858ms
I/zygote (16775): Background concurrent copying GC freed 85060(3MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/5MB, paused 248us total 157.631ms
I/zygote (16775): Background concurrent copying GC freed 80001(2MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/5MB, paused 176us total 258.969ms
Lost connection to device.
I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
I/utter_travelin(31159): Forcing collection of SoftReferences for 64KB allocation
I/utter_travelin(31159): Starting a blocking GC Alloc
I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
I/utter_travelin(31159): Alloc concurrent copying GC freed 20(712B) AllocSpace objects, 0(0B) LOS objects, 0% free, 47MB/48MB, paused 5us total 7.039ms
I/utter_travelin(31159): WaitForGcToComplete blocked Background on HeapTrim for 6.238ms
W/utter_travelin(31159): Throwing OutOfMemoryError "Failed to allocate a 65552 byte allocation with 53984 free bytes and 52KB until OOM, target footprint 50331648, growth limit 50331648" (VmSize 9934428 kB)
E/AndroidRuntime(31159): FATAL EXCEPTION: pool-1-thread-1
E/AndroidRuntime(31159): Process: com.example.flutter_traveling, PID: 31159
E/AndroidRuntime(31159): java.lang.OutOfMemoryError: Failed to allocate a 65552 byte allocation with 53984 free bytes and 52KB until OOM, target footprint 50331648, growth limit 50331648
E/AndroidRuntime(31159): at com.android.internal.util.FastXmlSerializer.<init>(FastXmlSerializer.java:86)
E/AndroidRuntime(31159): at com.android.internal.util.FastXmlSerializer.<init>(FastXmlSerializer.java:75)
E/AndroidRuntime(31159): at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:195)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:778)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.access$900(SharedPreferencesImpl.java:55)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:647)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:666)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:55)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:585)
E/AndroidRuntime(31159): at io.flutter.plugins.sharedpreferences.MethodCallHandlerImpl$1.run(MethodCallHandlerImpl.java:143)
E/AndroidRuntime(31159): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(31159): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(31159): at java.lang.Thread.run(Thread.java:919)
I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
W/System (31159): A resource failed to call close.
I/Process (31159): Sending signal. PID: 31159 SIG: 9
Lost connection to device.
Exited (sigterm)
Device keeps disconnecting from flutter, I don't know why, please help
In the Android simulator, this phenomenon is occurring continuously, and in ios, it works without any problem.
The Error Log shows
Throwing OutOfMemoryError
If you run your project on an emulator please clean it or uninstall your app.
So I'm using Android Studio on my PC and im testing the app in an emulator which works totally fine.
But when i try to use my smartphone connected to the pc, the app always crashes, when i try to switch the activity.
Everything else seems to work fine.
Anyone knows why this could be happening?
Thats the exception, that i get when the app chrashes:
[ 01-08 16:31:19.455 2922: 2922 E/ ]
process stopped due to unexpected signal 13
E/HAL: load: id=gralloc != hmi->id=gralloc
I/OpenGLRenderer: Initialized EGL, version 1.4
I/HwSecImmHelper: mSecurityInputMethodService is null
I/HwSecImmHelper: mSecurityInputMethodService is null
I/System: core_booster, getBoosterConfig = false
I/System: core_booster, getBoosterConfig = false
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc partial concurrent mark sweep GC freed 20(944B) AllocSpace objects, 0(0B) LOS objects, 4% free, 240MB/252MB, paused 251us total 9.704ms
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 11(12KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 240MB/252MB, paused 252us total 16.452ms
I/art: Forcing collection of SoftReferences for 91MB allocation
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 11(352B) AllocSpace objects, 0(0B) LOS objects, 4% free, 240MB/252MB, paused 343us total 16.178ms
W/art: Throwing OutOfMemoryError "Failed to allocate a 96412692 byte allocation with 12582912 free bytes and 15MB until OOM"
I have a lot of images say 500ish spread across 20 or so fragments, the images are all very small and it all loads fine, however i give the user a choice off 3 different kinds of images, and right now if the user changes images i get an OOM error, so i think its the way im handling the images i think i need to recycle the old ones first but im not confident on how to do that can anyone help?
here is how i populate my adapter ive just added two items to simplify things
private void prepareCardData(){
CardWriter cardWriter = new CardWriter(getResources().getDrawable(R.drawable.dog),"DOG","dog ");
cardMakerList.add(cardWriter);
cardWriter = new CardWriter(getResources().getDrawable(R.drawable.cat_ic),"CAT","cat ");
cardMakerList.add(cardWriter);
cardAdapter.notifyDataSetChanged();
}
and this is where i literally just wait for a shared preference change and call a method
private SharedPreferences.OnSharedPreferenceChangeListener listener = new
SharedPreferences.OnSharedPreferenceChangeListener() {
#Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if(key.equals("ICONS SELECTED")){
cardsChoice.setIcons(getActivity());
cardsToSet();
System.out.println("OneFrag pref listener");
}
}
};
public void cardsToSet(){
if (cardsChoice.bool_fragTwo == false) {
if (cardsChoice.group == 1) {
cardMakerList.clear();
prepareCardData();
cardsChoice.bool_fragTwo = true;
}
if (cardsChoice.group == 2) {
cardMakerList.clear();
prepareSimpleCardData();
cardsChoice.bool_fragTwo = true;
}
if (cardsChoice.group == 3) {
cardMakerList.clear();
preparePhotoCardData();
cardsChoice.bool_fragTwo = true;
}
}
}
so as mentioned i think i need to run this in its own thread and clear up and images that arent needed anymore but i think theres more to it then that can anyone help?
here is the stack trace
06-12 17:39:47.878 13189-13219/ss.sealstudios.com.socialstories E/Surface: getSlotFromBufferLocked: unknown buffer: 0x8a12fe70
06-12 17:39:47.985 13189-13189/ss.sealstudios.com.socialstories I/System.out: OneFrag pref listener
06-12 17:39:47.987 13189-13189/ss.sealstudios.com.socialstories I/System.out: OneFrag pref listener
06-12 17:39:48.233 13189-13199/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 265MB to 256MB
06-12 17:39:48.380 13189-13189/ss.sealstudios.com.socialstories I/System.out: OneFrag pref listener
06-12 17:39:48.410 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.410 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.416 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc sticky concurrent mark sweep GC freed 108(4KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 254MB/256MB, paused 303us total 5.710ms
06-12 17:39:48.417 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.433 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 283MB to 256MB
06-12 17:39:48.433 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc partial concurrent mark sweep GC freed 5841(393KB) AllocSpace objects, 2(3MB) LOS objects, 1% free, 251MB/256MB, paused 793us total 15.361ms
06-12 17:39:48.493 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.494 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.502 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc sticky concurrent mark sweep GC freed 17(688B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 545us total 7.748ms
06-12 17:39:48.503 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.526 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.526 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc partial concurrent mark sweep GC freed 23(944B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 494us total 22.482ms
06-12 17:39:48.527 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.567 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.567 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc concurrent mark sweep GC freed 9(12KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 499us total 38.887ms
06-12 17:39:48.568 13189-13189/ss.sealstudios.com.socialstories I/art: Forcing collection of SoftReferences for 2025KB allocation
06-12 17:39:48.568 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.597 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.597 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 501us total 28.481ms
06-12 17:39:48.601 13189-13189/ss.sealstudios.com.socialstories W/art: Throwing OutOfMemoryError "Failed to allocate a 2073612 byte allocation with 559872 free bytes and 546KB until OOM"
06-12 17:39:48.603 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.603 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.610 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc sticky concurrent mark sweep GC freed 3(448B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 484us total 6.214ms
06-12 17:39:48.611 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.643 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.643 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc partial concurrent mark sweep GC freed 6(192B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 1.131ms total 31.104ms
06-12 17:39:48.644 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.673 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.673 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 631us total 29.306ms
06-12 17:39:48.674 13189-13189/ss.sealstudios.com.socialstories I/art: Forcing collection of SoftReferences for 2025KB allocation
06-12 17:39:48.674 13189-13189/ss.sealstudios.com.socialstories I/art: Starting a blocking GC Alloc
06-12 17:39:48.704 13189-13189/ss.sealstudios.com.socialstories I/art: Clamp target GC heap from 287MB to 256MB
06-12 17:39:48.704 13189-13189/ss.sealstudios.com.socialstories I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 306us total 29.616ms
06-12 17:39:48.705 13189-13189/ss.sealstudios.com.socialstories W/art: Throwing OutOfMemoryError "Failed to allocate a 2073612 byte allocation with 559872 free bytes and 546KB until OOM"
06-12 17:39:48.709 13189-13189/ss.sealstudios.com.socialstories D/skia: --- allocation failed for scaled bitmap
06-12 17:39:48.709 13189-13189/ss.sealstudios.com.socialstories D/AndroidRuntime: Shutting down VM
06-12 17:39:48.724 13189-13189/ss.sealstudios.com.socialstories E/AndroidRuntime: FATAL EXCEPTION: main
Process: ss.sealstudios.com.socialstories, PID: 13189
java.lang.OutOfMemoryError: Failed to allocate a 2073612 byte allocation with 559872 free bytes and 546KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2738)
at android.content.res.Resources.loadDrawable(Resources.java:2643)
at android.content.res.Resources.getDrawable(Resources.java:833)
at android.content.res.Resources.getDrawable(Resources.java:786)
at ss.sealstudios.com.socialstories.TwoFragment.prepareCardData(TwoFragment.java:280)
at ss.sealstudios.com.socialstories.TwoFragment.cardsToSet(TwoFragment.java:245)
at ss.sealstudios.com.socialstories.TwoFragment$2.onSharedPreferenceChanged(TwoFragment.java:236)
at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:479)
at android.app.SharedPreferencesImpl$EditorImpl.apply(SharedPreferencesImpl.java:387)
at android.preference.Preference.tryCommit(Preference.java:1419)
at android.preference.Preference.persistString(Preference.java:1452)
at android.preference.ListPreference.setValue(ListPreference.java:148)
at android.preference.ListPreference.onDialogClosed(ListPreference.java:283)
at android.preference.DialogPreference.onDismiss(DialogPreference.java:395)
at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1328)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5527)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
After the threads in your project are finished, call the System.gc(); method.
i have no errors in my application but when i switch tabs it freezes and closes the application in the emulator and i'm new to the android studio and android development in general. i do not have a clue what to do next.
here is my logcat
03-23 11:56:05.749 2417-2417/com.example.hp_user.shoutfinal28 I/art: Not late-enabling -Xcheck:jni (already on)
03-23 11:56:05.994 2417-2417/com.example.hp_user.shoutfinal28 W/System: ClassLoader referenced unknown path: /data/app/com.example.hp_user.shoutfinal28-1/lib/x86
03-23 11:56:06.021 2417-2417/com.example.hp_user.shoutfinal28 I/GMPM: App measurement is starting up, version: 8487
03-23 11:56:06.021 2417-2417/com.example.hp_user.shoutfinal28 I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
03-23 11:56:06.032 2417-2417/com.example.hp_user.shoutfinal28 E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
03-23 11:56:06.032 2417-2417/com.example.hp_user.shoutfinal28 E/GMPM: Scheduler not set. Not logging error/warn.
03-23 11:56:06.209 2417-2433/com.example.hp_user.shoutfinal28 E/GMPM: Uploading is not possible. App measurement disabled
03-23 11:56:06.741 2417-2435/com.example.hp_user.shoutfinal28 D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
03-23 11:56:07.233 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 42.830ms
03-23 11:56:07.507 2417-2435/com.example.hp_user.shoutfinal28 I/OpenGLRenderer: Initialized EGL, version 1.4
03-23 11:56:07.670 2417-2435/com.example.hp_user.shoutfinal28 W/EGL_emulation: eglSurfaceAttrib not implemented
03-23 11:56:07.670 2417-2435/com.example.hp_user.shoutfinal28 W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad92f000, error=EGL_SUCCESS
03-23 11:56:07.874 2417-2417/com.example.hp_user.shoutfinal28 I/Choreographer: Skipped 46 frames! The application may be doing too much work on its main thread.
03-23 11:56:09.040 2417-2417/com.example.hp_user.shoutfinal28 I/Choreographer: Skipped 67 frames! The application may be doing too much work on its main thread.
03-23 11:56:14.016 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 10.772ms
03-23 11:56:16.753 2417-2433/com.example.hp_user.shoutfinal28 I/GMPM: Tag Manager is not found and thus will not be used
03-23 11:56:16.910 2417-2422/com.example.hp_user.shoutfinal28 I/art: Thread[2,tid=2422,WaitingInMainSignalCatcherLoop,Thread*=0xad90ed00,peer=0x12c7a0a0,"Signal Catcher"]: reacting to signal 3
03-23 11:56:17.048 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 46.962ms
03-23 11:56:17.211 2417-2422/com.example.hp_user.shoutfinal28 I/art: Wrote stack traces to '/data/anr/traces.txt'
03-23 11:56:22.415 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 6.324ms
03-23 11:56:33.717 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 12.067ms
03-23 11:56:39.211 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 17.079ms
03-23 11:57:13.188 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 12.698ms
03-23 11:57:15.690 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.155ms
03-23 11:57:19.158 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.179ms
03-23 11:57:21.138 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 10.996ms
03-23 11:57:40.748 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.140ms
03-23 11:57:46.163 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 6.413ms
03-23 11:57:57.981 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 8.603ms
03-23 11:58:00.909 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 12.863ms
03-23 11:58:04.638 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 21.404ms
03-23 11:58:18.369 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 21.777ms
03-23 11:58:24.334 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 31.972ms
03-23 11:58:24.769 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 12.558ms
03-23 11:58:25.399 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 21.461ms
03-23 11:58:35.213 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.951ms
03-23 11:58:38.694 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.319ms
03-23 11:58:51.712 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 10.430ms
03-23 11:59:08.130 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.958ms
03-23 11:59:16.520 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 12.715ms
03-23 11:59:28.920 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 31.685ms
03-23 11:59:29.423 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 15.909ms
03-23 11:59:30.402 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.648ms
03-23 11:59:30.923 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 16.189ms
03-23 11:59:57.004 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 6.171ms
03-23 12:00:04.514 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.080ms
03-23 12:00:05.500 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 21.063ms
03-23 12:00:09.465 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.965ms
03-23 12:00:19.918 2417-2423/com.example.hp_user.shoutfinal28 W/art:
Suspending all threads took: 9.964ms
03-23 12:00:21.427 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 17.293ms
03-23 12:00:30.382 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 13.516ms
03-23 12:01:20.767 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.766ms
03-23 12:01:32.806 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 26.784ms
03-23 12:01:33.904 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 36.950ms
03-23 12:02:18.777 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 6.365ms
03-23 12:02:39.284 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 14.412ms
03-23 12:03:00.297 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 25.732ms
03-23 12:03:01.280 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 8.056ms
03-23 12:03:12.798 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.714ms
03-23 12:03:17.801 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 8.841ms
03-23 12:03:23.760 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.779ms
03-23 12:03:44.725 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 13.453ms
03-23 12:03:52.812 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 66.320ms
03-23 12:03:57.738 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.062ms
03-23 12:04:12.258 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.525ms
03-23 12:04:14.760 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.565ms
03-23 12:04:16.782 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 19.185ms
03-23 12:04:23.730 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.169ms
03-23 12:04:31.254 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.048ms
03-23 12:04:38.743 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 10.787ms
03-23 12:05:00.175 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 106.406ms
03-23 12:05:02.590 2417-2435/com.example.hp_user.shoutfinal28 W/EGL_emulation: eglSurfaceAttrib not implemented
03-23 12:05:02.590 2417-2435/com.example.hp_user.shoutfinal28 W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa21045c0, error=EGL_SUCCESS
03-23 12:05:04.016 2417-2435/com.example.hp_user.shoutfinal28 E/Surface: getSlotFromBufferLocked: unknown buffer: 0xabfe4d10
03-23 12:05:06.035 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 15606(1053KB) AllocSpace objects, 6(120KB) LOS objects, 37% free, 2MB/3MB, paused 19.193ms total 246.150ms
03-23 12:05:06.076 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 16.765ms
03-23 12:05:06.509 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 1885(1770KB) AllocSpace objects, 1(24KB) LOS objects, 39% free, 3MB/6MB, paused 24.099ms total 241.046ms
03-23 12:05:06.553 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.531ms
03-23 12:05:06.767 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 20.589ms
03-23 12:05:06.918 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 1034(2MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 5MB/6MB, paused 129.285ms total 303.506ms
03-23 12:05:06.929 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 9.437ms
03-23 12:05:07.075 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 39.477ms
03-23 12:05:07.086 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.998ms
03-23 12:05:07.187 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 464(1401KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 5MB/6MB, paused 65.404ms total 239.195ms
03-23 12:05:07.220 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 31.710ms
03-23 12:05:07.510 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 517(1538KB) AllocSpace objects, 0(0B) LOS objects, 36% free, 7MB/11MB, paused 29.730ms total 245.372ms
03-23 12:05:07.865 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 810(3MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 8MB/11MB, paused 60.048ms total 195.013ms
03-23 12:05:08.085 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.930ms
03-23 12:05:08.097 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 558(2MB) AllocSpace objects, 0(0B) LOS objects, 2% free, 10MB/11MB, paused 57.680ms total 199.141ms
03-23 12:05:08.372 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 330(1634KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 11MB/11MB, paused 45.586ms total 260.298ms
03-23 12:05:08.593 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.991ms
03-23 12:05:08.599 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 474(2MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 12MB/16MB, paused 52.037ms total 213.333ms
03-23 12:05:08.871 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 13.742ms
03-23 12:05:08.973 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 1030(5MB) AllocSpace objects, 0(0B) LOS objects, 8% free, 15MB/16MB, paused 136.535ms total 320.111ms
03-23 12:05:09.127 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 61.076ms
03-23 12:05:09.133 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.412ms
03-23 12:05:09.227 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 366(1835KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 17MB/17MB, paused 69.814ms total 225.055ms
03-23 12:05:09.546 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 19.416ms
03-23 12:05:09.556 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 639(2MB) AllocSpace objects, 29(464KB) LOS objects, 17% free, 18MB/22MB, paused 70.188ms total 317.219ms
03-23 12:05:09.576 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 19.102ms
03-23 12:05:09.976 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 555(2MB) AllocSpace objects, 183(2MB) LOS objects, 10% free, 20MB/22MB, paused 79.907ms total 322.037ms
03-23 12:05:09.989 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 11.923ms
03-23 12:05:10.486 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 427(1679KB) AllocSpace objects, 140(2MB) LOS objects, 14% free, 23MB/27MB, paused 72.435ms total 402.265ms
03-23 12:05:10.875 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 501(2005KB) AllocSpace objects, 165(2MB) LOS objects, 7% free, 25MB/27MB, paused 81.908ms total 324.161ms
03-23 12:05:10.884 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.802ms
03-23 12:05:11.172 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 165.365ms
03-23 12:05:11.288 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 273(1063KB) AllocSpace objects, 89(1424KB) LOS objects, 12% free, 27MB/31MB, paused 75.815ms total 355.692ms
03-23 12:05:11.747 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 230.989ms
03-23 12:05:11.778 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 5.070ms
03-23 12:05:11.905 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 447(1787KB) AllocSpace objects, 147(2MB) LOS objects, 12% free, 27MB/31MB, paused 121.279ms total 547.928ms
03-23 12:05:11.913 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.013ms
03-23 12:05:12.200 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 144.899ms
03-23 12:05:12.218 2417-2427/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 7.041ms
03-23 12:05:12.394 2417-2427/com.example.hp_user.shoutfinal28 I/art: Clamp target GC heap from 32MB to 32MB
03-23 12:05:12.394 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background partial concurrent mark sweep GC freed 303(1183KB) AllocSpace objects, 98(1952KB) LOS objects, 10% free, 28MB/32MB, paused 167.749ms total 431.021ms
03-23 12:05:12.555 2417-2417/com.example.hp_user.shoutfinal28 I/art: Waiting for a blocking GC Alloc
03-23 12:05:12.629 2417-2423/com.example.hp_user.shoutfinal28 W/art: Suspending all threads took: 147.707ms
03-23 12:05:12.730 2417-2427/com.example.hp_user.shoutfinal28 I/art: Background sticky concurrent mark sweep GC freed 242(978KB) AllocSpace objects, 80(1600KB) LOS objects, 7% free, 29MB/32MB, paused 86.419ms total 299.323ms
03-23 12:05:12.732 2417-2417/com.example.hp_user.shoutfinal28 I/art: WaitForGcToComplete blocked for 177.147ms for cause Alloc
03-23 12:05:12.733 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:12.769 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:12.769 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.069 2417-2417/com.example.hp_user.shoutfinal28 I/art: Clamp target GC heap from 34MB to 32MB
03-23 12:05:13.069 2417-2417/com.example.hp_user.shoutfinal28 I/art: Alloc partial concurrent mark sweep GC freed 168(604KB) AllocSpace objects, 51(1020KB) LOS objects, 5% free, 30MB/32MB, paused 65.635ms total 298.511ms
03-23 12:05:13.101 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.102 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.321 2417-2417/com.example.hp_user.shoutfinal28 I/art: Alloc sticky concurrent mark sweep GC freed 74(301KB) AllocSpace objects, 24(480KB) LOS objects, 4% free, 30MB/32MB, paused 62.666ms total 217.832ms
03-23 12:05:13.329 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.329 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.643 2417-2417/com.example.hp_user.shoutfinal28 I/art: Clamp target GC heap from 34MB to 32MB
03-23 12:05:13.643 2417-2417/com.example.hp_user.shoutfinal28 I/art: Alloc partial concurrent mark sweep GC freed 48(145KB) AllocSpace objects, 14(280KB) LOS objects, 4% free, 30MB/32MB, paused 63.546ms total 312.988ms
03-23 12:05:13.660 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.661 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
03-23 12:05:13.870 2417-2417/com.example.hp_user.shoutfinal28 I/art: Alloc sticky concurrent mark sweep GC freed 31(37KB) AllocSpace objects, 26(468KB) LOS objects, 3% free, 30MB/32MB, paused 63.375ms total 208.351ms
03-23 12:05:13.877 2417-2417/com.example.hp_user.shoutfinal28 I/art: Starting a blocking GC Alloc
i believe this is the class causing it to crash, before i created this class and 4th tab my app ran fine but the other two classes are pretty much empty apart from the tabs.
package com.example.hp_user.shoutfinal28;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
public class FragmentShouts_Maps extends Fragment implements OnMapReadyCallback {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragment shouts.xml
View view = inflater.inflate(R.layout.fragmentshouts_maps, container, false);
SupportMapFragment fragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.maps);
if (fragment!= null) {
fragment.getMapAsync(this);
}
return view;
}
#Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
#Override
public void onMapReady (GoogleMap googleMap) {
}
}
here is my ViewPagerAdapter
public class ViewPagerAdapter extends FragmentPagerAdapter {
final int PAGE_COUNT = 4;
// Tab Titles
private String tabtitles[] = new String[] {"Home","Shouts","Maps","Shouters"};
Context context;
public ViewPagerAdapter(FragmentManager fm) {
super(fm);
}
#Override
public int getCount() {
return PAGE_COUNT;
}
public Fragment getItem(int position) {
switch (position) {
// Open Fragment home.java
case 0:
FragmentHome fragmenthome = new FragmentHome();
return fragmenthome;
// Open Fragment shouters.java
case 1:
FragmentShouts fragmentshouts = new FragmentShouts();
return fragmentshouts;
case 2:
FragmentShouts_Maps fragmentshouts_maps = new FragmentShouts_Maps();
return fragmentshouts_maps;
case 3:
FragmentShouters fragmentshouters = new FragmentShouters();
return fragmentshouters;
}
return null;
}
#Override
public CharSequence getPageTitle(int position) {
return tabtitles[position];
}
here is my main activity class, i think i slightly agree with you, its a sliding tab strip which isnt natural for android, more commonly seen in ios devices and it worked smoothly before the implementation of the fourth tab but i noticed my toast would react slowly when user input was stored after a button was clicked
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the view from activity_main.xml
setContentView(R.layout.activity_main);
// Locate the viewpager in activity_main.xml
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
// Set the ViewPagerAdapter into ViewPager
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
}
public void btnShout(View v) {
//allows for label to be changed to shouted once button is pressed
EditText txtInput = (EditText) findViewById(R.id.txtInput);
TextView lblShout = (TextView) findViewById(R.id.lblShout);
lblShout.setText("Shouted! ");
//allows for toast to be displayed once button is clicked
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.TOP | Gravity.LEFT, 0, 0);
toast.makeText(MainActivity.this, txtInput.getText() + " Has Been Shouted.", toast.LENGTH_SHORT).show();
}
}
You're doing too much work on the main thread.
03-23 11:56:07.874 2417-2417/com.example.hp_user.shoutfinal28 I/Choreographer: Skipped 46 frames! The application may be doing too much work on its main thread.
03-23 11:56:09.040 2417-2417/com.example.hp_user.shoutfinal28 I/Choreographer: Skipped 67 frames! The application may be doing too much work on its main thread.
If you are in need of executing long-running code, you should take a look at Android's threading tools (http://developer.android.com/guide/components/processes-and-threads.html and http://developer.android.com/training/multiple-threads/index.html). AsyncTask (http://developer.android.com/reference/android/os/AsyncTask.html) is your friend =)