2010-09-02 7 views
3

J'ai un problème avec une exception de mémoire insuffisante qui se produit uniquement sur certains appareils (principalement HTC Desire). Il arrive là chaque fois qu'un utilisateur commence une certaine activité (peu importe comment - il y a deux chemins à cette activité) et je suis vraiment perplexe quant à pourquoi (j'ai vérifié des fuites et ne pourrais pas trouver) ...Android: étrange exception de mémoire

L'erreur est renvoyée lors de l'appel de setContentView ou peu après.

C'est le bloc de code qui jette l'erreur:

protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    if(DebugFlags.LOG_MEMORY) 
    { 
     MemoryAnalyser.logHeap(this.getClass()); 
    } 
    setContentView(R.layout.activity_stats); 
    try 
    { 
    monthsAvailable = getMonthTimeStamps(); 
    Spinner xSpin = (Spinner) findViewById(R.id.spinnerTimespan); 
    m_adapterForSpinner = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item);  
    m_adapterForSpinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
    xSpin.setAdapter(m_adapterForSpinner); 
    for(Iterator<monthObject> i = monthsAvailable.iterator();i.hasNext();) 
    { 
     monthObject xObj = i.next(); 
     String dateString = String.format("%1$te.%1$tm.%1$tY - %2$te.%2$tm.%2$tY", xObj.fromDate, xObj.toDate); 
     m_adapterForSpinner.add(dateString); 
    } 
    xSpin.setSelection(xSpin.getCount()-1); 
    xSpin.setOnItemSelectedListener(this); 
    //setupStatData(null, null); 
    checkStatsAvailable(); 
    //throw(new java.lang.OutOfMemoryError()); 
    } 
    catch(java.lang.OutOfMemoryError e) 
    { 
     MemoryAnalyser.dumpHeap(); 
     MemoryAnalyser.logHeap(this.getClass()); 
     Toast xToast = Toast.makeText(getApplicationContext(), "OutOfMemoryException - bitte Log und Datei com.eventkontor.networkcheck.hprof auf SD-Karte an Entwickler senden", 5000); 
     xToast.show(); 
     this.finish(); 
    } 
    if(DebugFlags.LOG_MEMORY) 
    { 
     MemoryAnalyser.logHeap(this.getClass()); 
    } 
} 

comme je l'ai dit - l'erreur est habituellement jeté lors de l'appel setContentView ou lorsque vous appelez getMonthTimeStamps()

getMonthTimeStamps est une fonction d'aide qui crée une liste de dates disponibles dans la base de données interne. Il crée un couple de (petits objets) et renvoie une ArrayList. Voici la fonction

private ArrayList<monthObject> getMonthTimeStamps() 
{ 
    ArrayList<monthObject> dates = new ArrayList<monthObject>(); 
    Cursor c = getContentResolver().query(CallLogTableMetaData.CONTENT_URI, new String[]{CallLogTableMetaData.CALLOG_DATE}, null, null, CallLogTableMetaData._ID + " asc"); 
    try{ 

    if(c.moveToFirst()) 
    { 
     SharedPreferences prefs = Utils.getPreferences(this); 
     int resetDay = prefs.getInt("pref_callog_reset_day", 1); 
     prefs = null; 
     long starttime = c.getLong(0); 
     c.close(); 
     c=null; 
     Date startDate = new Date(starttime); 
     GregorianCalendar today = new GregorianCalendar(); 
     GregorianCalendar xCal = new GregorianCalendar(); 
     xCal.setTime(startDate); 
     xCal.set(GregorianCalendar.DAY_OF_MONTH, resetDay); 
     while(xCal.before(today)) 
     { 
      monthObject xObj = new monthObject(); 
      xObj.setTimestamp(xCal.getTimeInMillis()); 
      xObj.setFromDate(xCal.getTime()); 
      xCal.add(GregorianCalendar.MONTH, 1); 
      xCal.set(GregorianCalendar.DAY_OF_MONTH, resetDay); 
      xCal.set(Calendar.HOUR_OF_DAY, 0); 
      xCal.set(Calendar.MINUTE, 0); 
      xCal.set(Calendar.SECOND, 0); 
      xCal.set(Calendar.MILLISECOND, 0); 
      xObj.setToDate(xCal.getTime()); 
      xObj.setToTimestamp(xCal.getTimeInMillis()); 
      dates.add(xObj); 
      xObj = null; 
     } 
     xCal = null; 
     today = null; 
     return dates; 
    } 
    else 
    { 
     return dates; 
    } 
    } 
    finally{ 
     try 
     { 
      c.close(); 
     } 
     catch(Exception e) 
     { 

     } 
    } 
    } 

Je ne prétends pas que mon code est impeccable ou parfait, mais je ne comprends vraiment pas pourquoi cette erreur est levée. La mise en page XML ne contient aucune référence aux images et n'est pas très compliquée (textview, spinner, tablelayout).

Voici le journal des erreurs i reçu d'un utilisateur:

I/ActivityManager(16789): Starting activity: Intent { cmp=com.eventkontor.networkcheck/.StatActivity } 
D/dalvikvm(5053): GC freed 8267 objects/556152 bytes in 45ms 
D/dalvikvm(5053): GC freed 1716 objects/371240 bytes in 45ms 
D/dalvikvm(5053): GC freed 15 objects/62936 bytes in 56ms 
D/dalvikvm(5053): GC freed 4 objects/233856 bytes in 77ms 
D/dalvikvm(5053): GC freed 14 objects/544 bytes in 83ms 
W/ActivityManager(16789): Launch timeout has expired, giving up wake lock! 
W/ActivityManager(16789): Activity idle timeout for HistoryRecord{46a4b878 com.eventkontor.networkcheck/.StatActivity} 
D/dalvikvm(5053): GC freed 3 objects/210456 bytes in 107ms 
D/dalvikvm(5053): GC freed 3 objects/315656 bytes in 118ms 
D/dalvikvm(5210): GC freed 7752 objects/904320 bytes in 1116ms 
D/dalvikvm(5053): GC freed 2 objects/48 bytes in 136ms 
D/dalvikvm(5053): GC freed 3 objects/473448 bytes in 155ms 
D/dalvikvm( 641): GC freed 4397 objects/781024 bytes in 1246ms 
D/dalvikvm(5053): GC freed 2 objects/48 bytes in 175ms 
D/dalvikvm(5053): GC freed 2 objects/56 bytes in 203ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.522MB to 24.000MB 
D/dalvikvm(5053): GC freed 3 objects/710120 bytes in 207ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 2 objects/56 bytes in 220ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.012MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 16-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 238ms 
I/dalvikvm-heap(5053): Forcing collection of SoftReferences for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 220ms 
E/dalvikvm-heap(5053): Out of memory on a 24-byte allocation. 
I/dalvikvm(5053): "HeapWorker" daemon prio=5 tid=5 RUNNABLE 
I/dalvikvm(5053): | group="system" sCount=0 dsCount=0 s=N obj=0x44e0eab8 self=0x14a298 
I/dalvikvm(5053): | sysTid=5054 nice=0 sched=0/0 cgrp=default handle=1351480 
I/dalvikvm(5053): at com.android.internal.os.BinderInternal$GcWatcher.finalize(BinderInternal.java:~48) 
I/dalvikvm(5053): at dalvik.system.NativeStart.run(Native Method) 
I/dalvikvm(5053): 
E/dalvikvm(5053): Out of memory: Heap Size=22791KB, Allocated=22204KB, Bitmap Size=1806KB 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 291ms 
I/dalvikvm-heap(5053): Forcing collection of SoftReferences for 40-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 220ms 
E/dalvikvm-heap(5053): Out of memory on a 40-byte allocation. 
I/dalvikvm(5053): "main" prio=5 tid=3 RUNNABLE 
I/dalvikvm(5053): | group="main" sCount=0 dsCount=0 s=N obj=0x4001b470 self=0xbdd0 
I/dalvikvm(5053): | sysTid=5053 nice=0 sched=0/0 cgrp=default handle=-1343993180 
I/dalvikvm(5053): at com.eventkontor.networkcheck.StatActivity.getMonthTimeStamps(StatActivity.java:~270) 
I/dalvikvm(5053): at com.eventkontor.networkcheck.StatActivity.onCreate(StatActivity.java:119) 
I/dalvikvm(5053): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
I/dalvikvm(5053): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544) 
I/dalvikvm(5053): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621) 
I/dalvikvm(5053): at android.app.ActivityThread.access$2200(ActivityThread.java:126) 
I/dalvikvm(5053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932) 
I/dalvikvm(5053): at android.os.Handler.dispatchMessage(Handler.java:99) 
I/dalvikvm(5053): at android.os.Looper.loop(Looper.java:123) 
I/dalvikvm(5053): at android.app.ActivityThread.main(ActivityThread.java:4595) 
I/dalvikvm(5053): at java.lang.reflect.Method.invokeNative(Native Method) 
I/dalvikvm(5053): at java.lang.reflect.Method.invoke(Method.java:521) 
I/dalvikvm(5053): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
I/dalvikvm(5053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
I/dalvikvm(5053): at dalvik.system.NativeStart.main(Native Method) 
I/dalvikvm(5053): 
E/dalvikvm(5053): Out of memory: Heap Size=22791KB, Allocated=22204KB, Bitmap Size=1806KB 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 231ms 
I/dalvikvm-heap(5053): Forcing collection of SoftReferences for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 220ms 
E/dalvikvm-heap(5053): Out of memory on a 24-byte allocation. 
I/dalvikvm(5053): "HeapWorker" daemon prio=5 tid=5 RUNNABLE 
I/dalvikvm(5053): | group="system" sCount=0 dsCount=0 s=N obj=0x44e0eab8 self=0x14a298 
I/dalvikvm(5053): | sysTid=5054 nice=0 sched=0/0 cgrp=default handle=1351480 
I/dalvikvm(5053): at com.android.internal.os.BinderInternal$GcWatcher.finalize(BinderInternal.java:~48) 
I/dalvikvm(5053): at dalvik.system.NativeStart.run(Native Method) 
I/dalvikvm(5053): 
E/dalvikvm(5053): Out of memory: Heap Size=22791KB, Allocated=22204KB, Bitmap Size=1806KB 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
I/dalvikvm(5053): Uncaught exception thrown by finalizer (will be discarded): 
I/dalvikvm(5053): Ljava/lang/OutOfMemoryError;: [memory exhausted] 
I/dalvikvm(5053): at dalvik.system.NativeStart.main(Native Method) 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 237ms 
I/dalvikvm-heap(5053): Forcing collection of SoftReferences for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.012MB to 24.000MB 
D/dalvikvm(5053): GC freed 1 objects/16 bytes in 220ms 
E/dalvikvm-heap(5053): Out of memory on a 24-byte allocation. 
I/dalvikvm(5053): "main" prio=5 tid=3 RUNNABLE 
I/dalvikvm(5053): | group="main" sCount=0 dsCount=0 s=N obj=0x4001b470 self=0xbdd0 
I/dalvikvm(5053): | sysTid=5053 nice=0 sched=0/0 cgrp=default handle=-1343993180 
I/dalvikvm(5053): at com.eventkontor.networkcheck.StatActivity.getMonthTimeStamps(StatActivity.java:~270) 
I/dalvikvm(5053): at com.eventkontor.networkcheck.StatActivity.onCreate(StatActivity.java:119) 
I/dalvikvm(5053): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
I/dalvikvm(5053): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544) 
I/dalvikvm(5053): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621) 
I/dalvikvm(5053): at android.app.ActivityThread.access$2200(ActivityThread.java:126) 
I/dalvikvm(5053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932) 
I/dalvikvm(5053): at android.os.Handler.dispatchMessage(Handler.java:99) 
I/dalvikvm(5053): at android.os.Looper.loop(Looper.java:123) 
I/dalvikvm(5053): at android.app.ActivityThread.main(ActivityThread.java:4595) 
I/dalvikvm(5053): at java.lang.reflect.Method.invokeNative(Native Method) 
I/dalvikvm(5053): at java.lang.reflect.Method.invoke(Method.java:521) 
I/dalvikvm(5053): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
I/dalvikvm(5053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
I/dalvikvm(5053): at dalvik.system.NativeStart.main(Native Method) 
I/dalvikvm(5053): 
E/dalvikvm(5053): Out of memory: Heap Size=22791KB, Allocated=22204KB, Bitmap Size=1806KB 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 11 objects/728 bytes in 221ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 221ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 136-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 219ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 220ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 54-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 4 objects/272 bytes in 221ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 24-byte allocation 
I/dalvikvm-heap(5053): Clamp target GC heap from 26.011MB to 24.000MB 
D/dalvikvm(5053): GC freed 0 objects/0 bytes in 240ms 
I/dalvikvm-heap(5053): Clamp target GC heap from 24.011MB to 24.000MB 
I/dalvikvm-heap(5053): Grow heap (frag case) to 24.000MB for 68-byte allocation 
D/dalvikvm(5053): GC freed 589340 objects/19930400 bytes in 180ms 
I/dalvikvm(5053): hprof: dumping VM heap to "/sdcard/com.eventkontor.networkcheck.hprof-hptemp". 
I/dalvikvm(5053): hprof: dumping heap strings to "/sdcard/com.eventkontor.networkcheck.hprof". 
I/dalvikvm(5053): hprof: heap dump completed, temp file removed 
D/dalvikvm(5053): GC freed 8 objects/616 bytes in 1056ms 
D/NetworkCheck(5053): debug. ================================= 
D/NetworkCheck(5053): debug.heap native: allocated 5,81MB of 6,94MB (0,61MB free) in [com.eventkontor.networkcheck.StatActivity] 
D/NetworkCheck(5053): debug.memory: allocated: 22,00MB of 24,00MB (19,00MB free) 
D/dalvikvm(5053): GC freed 148 objects/7608 bytes in 34ms 
D/dalvikvm(5053): GC freed 5 objects/264 bytes in 33ms 
E/dalvikvm-heap(5053): 32980-byte external allocation too large for this process. 
E/dalvikvm(5053): Out of memory: Heap Size=22791KB, Allocated=2743KB, Bitmap Size=1806KB 
E/  (5053): VM won't let us allocate 32980 bytes 
D/skia (5053): --- decoder->decode returned false 
D/AndroidRuntime(5053): Shutting down VM 
W/dalvikvm(5053): threadid=3: thread exiting with uncaught exception (group=0x4001b390) 
D/UNHANDLED_EXCEPTION(5053): Writing unhandled exception to: /data/data/com.eventkontor.networkcheck/files/1.5-55980.stacktrace 
I/global (5053): Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required. 
D/UNHANDLED_EXCEPTION(5053): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eventkontor.networkcheck/com.eventkontor.networkcheck.StatActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class <unknown> 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621) 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread.access$2200(ActivityThread.java:126) 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932) 
D/UNHANDLED_EXCEPTION(5053): at android.os.Handler.dispatchMessage(Handler.java:99) 
D/UNHANDLED_EXCEPTION(5053): at android.os.Looper.loop(Looper.java:123) 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread.main(ActivityThread.java:4595) 
D/UNHANDLED_EXCEPTION(5053): at java.lang.reflect.Method.invokeNative(Native Method) 
D/UNHANDLED_EXCEPTION(5053): at java.lang.reflect.Method.invoke(Method.java:521) 
D/UNHANDLED_EXCEPTION(5053): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
D/UNHANDLED_EXCEPTION(5053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
D/UNHANDLED_EXCEPTION(5053): at dalvik.system.NativeStart.main(Native Method) 
D/UNHANDLED_EXCEPTION(5053): Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class <unknown> 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 
D/UNHANDLED_EXCEPTION(5053): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
D/UNHANDLED_EXCEPTION(5053): at android.widget.Toast.makeText(Toast.java:235) 
D/UNHANDLED_EXCEPTION(5053): at com.eventkontor.networkcheck.StatActivity.onCreate(StatActivity.java:140) 
D/UNHANDLED_EXCEPTION(5053): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
D/UNHANDLED_EXCEPTION(5053): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544) 
D/UNHANDLED_EXCEPTION(5053): ... 11 more 
D/UNHANDLED_EXCEPTION(5053): Caused by: java.lang.reflect.InvocationTargetException 
D/UNHANDLED_EXCEPTION(5053): at android.widget.LinearLayout.<init>(LinearLayout.java:92) 
D/UNHANDLED_EXCEPTION(5053): at java.lang.reflect.Constructor.constructNative(Native Method) 
D/UNHANDLED_EXCEPTION(5053): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 
D/UNHANDLED_EXCEPTION(5053): at android.view.LayoutInflater.createView(LayoutInflater.java:500) 
D/UNHANDLED_EXCEPTION(5053): ... 20 more 
D/UNHANDLED_EXCEPTION(5053): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:464) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:340) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 
D/UNHANDLED_EXCEPTION(5053): at android.content.res.Resources.loadDrawable(Resources.java:1705) 
D/UNHANDLED_EXCEPTION(5053): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 
D/UNHANDLED_EXCEPTION(5053): at android.view.View.<init>(View.java:1850) 
D/UNHANDLED_EXCEPTION(5053): at android.view.View.<init>(View.java:1799) 
D/UNHANDLED_EXCEPTION(5053): at android.view.ViewGroup.<init>(ViewGroup.java:296) 
D/UNHANDLED_EXCEPTION(5053): ... 24 more 

Merci

Andreas

+2

Qu'est-ce que la ligne 270 dans getMonthTimestamps()/StatActivity (qui semble être l'endroit où se passe l'allocation spécifique)? Je suppose que vous entrez dans une boucle infinie/longue en quelque sorte et la ligne 270 est monthObject xObj = new monthObject(); (puisque vous enregistrez tous les xObjs dans ArrayList). Peut-être pourriez-vous savoir combien d'itérations la boucle fonctionne en cas de crash? – antonyt

+0

Oui, je n'y ai pas pensé (parce que ce n'est pas supposé arriver/parce que ça ne peut pas se faire sous la normale, du moins dans les règles de la relativité générale). Je vais ajouter quelques lignes pour tracer cela et voir ce qui se passe. Merci! – Andreas

+0

Ok, il semble que l'application est bloquée dans une boucle infinie (ce qui ne devrait pas arriver). Je vais devoir vérifier les circonstances dans lesquelles cela se passe ... – Andreas

Répondre

0

Il suffit de lire le stacktrace vous problème semble être que vous essayez de charger une image bitmap. Cela est indiqué comme une cause racine Êtes-vous chargement tas d'images? Cette exception empêche le gonflement de votre mise en page. Vous avez besoin d'un cache d'éther ou réduisez la taille de vos images. Regardez et debug par ces

D/UNHANDLED_EXCEPTION(5053): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:464) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:340) 
D/UNHANDLED_EXCEPTION(5053): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 
D/UNHANDLED_EXCEPTION(5053): at android.content.res.Resources.loadDrawable(Resources.java:1705) 
D/UNHANDLED_EXCEPTION(5053): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 
D/UNHANDLED_EXCEPTION(5053): at android.view.View.<init>(View.java:1850) 
D/UNHANDLED_EXCEPTION(5053): at android.view.View.<init>(View.java:1799) 
D/UNHANDLED_EXCEPTION(5053): at android.view.ViewGroup.<init>(ViewGroup.java:296) 
+0

Non, je n'essaie pas de charger une image bitmap - cette erreur est renvoyée après l'exception OutOfMemoryException d'origine lorsque j'essaie de créer un message TOAST. L'erreur était une boucle infinie (comme suggéré ci-dessus). Merci! – Andreas

0

Avez-vous regardé des questions connexes? Voici un SO pertinent: search. Quelques-uns d'entre eux pointent vers ce answer sur l'utilisation de la classe BitmapFactory. Cette approche down-échantillonne chacune des images pour réduire leur impact sur la mémoire. J'espère que cela aide.

+1

L'exception inflate se produit uniquement après l'exception OutOfMemory.J'ai lu ces autres articles et ils (malheureusement) ne s'appliquent pas ici ... Je ne charge aucune image (et la mise en page n'en contient pas non plus). Je vous remercie! – Andreas

1

C'était une boucle infinie causée par GregorianCalendar n'incrémentant pas la date. Toujours en train d'enquêter sur le problème, mais celui-ci a été résolu.