2014년 12월 25일 목요일

app crashes when I add long image

I have 2 vertical arrangement (arr1,arr2) with 10 JPG images in each of them
I have 1 additional vertical arrangement with 1 long JPG image (100kb)
blocks board is empty
my apk file size: 3.5 MB

every time when I start the app it crashes "unfortunately <app name> has stopeed"
If I change image in additional vertical arrangement to another smaller image its work partially (somtimes it works and sometime crashes)
I add an attachment




How big is your AIA file?  When you say "When I start the app," does that mean in the emulator or on a device?  Please read my tips below.  Happy Holidays!




my AIA size is 2.6MB
app starts in the device
I know that AIA size is limited to 5 MB so I dont see any reason for the crash
and I dont use blocks because I dont need them right now, I just start to build the app

note: when I remove some images from screen1 (but does not delete them from app inventor) it works good



to find out, why it force closes. you can use logcat, see also
let us know the logcat result...



I get this over and over in logcat: (I tried on the emulator)

12-26 11:12:56.839: D/AppInvHTTPD(244): NanoHTTPD: getPoolSize() = 2
12-26 11:12:56.859: I/global(244): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-26 11:12:56.869: I/global(244): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-26 11:12:56.869: D/AppInvHTTPD(244): POST '/_values' 

and I had some recoeds in red:

12-26 11:07:18.468: E/ActivityManager(68): ANR in edu.mit.appinventor.aicompanion3 (edu.mit.appinventor.aicompanion3/.Screen1)
12-26 11:07:18.468: E/ActivityManager(68): Reason: keyDispatchingTimedOut
12-26 11:07:18.468: E/ActivityManager(68): Load: 7.79 / 2.04 / 0.69
12-26 11:07:18.468: E/ActivityManager(68): CPU usage from 8428ms to 2295ms ago:
12-26 11:07:18.468: E/ActivityManager(68):   or.aicompanion3: 58% = 48% user + 10% kernel / faults: 3393 minor 109 major
12-26 11:07:18.468: E/ActivityManager(68):   system_server: 17% = 8% user + 9% kernel / faults: 2355 minor 77 major
12-26 11:07:18.468: E/ActivityManager(68):   e.process.gapps: 11% = 5% user + 6% kernel / faults: 1933 minor 35 major
12-26 11:07:18.468: E/ActivityManager(68):   android.protips: 5% = 1% user + 4% kernel / faults: 3074 minor 1 major
12-26 11:07:18.468: E/ActivityManager(68):   m.android.music: 5% = 2% user + 3% kernel / faults: 3103 minor 4 major
12-26 11:07:18.468: E/ActivityManager(68):   app_process: 2% = 1% user + 1% kernel / faults: 536 minor 2 major
12-26 11:07:18.468: E/ActivityManager(68):   d.process.media: 1% = 0% user + 0% kernel / faults: 690 minor 4 major
12-26 11:07:18.468: E/ActivityManager(68):   d.process.acore: 0% = 0% user + 0% kernel / faults: 382 minor 6 major
12-26 11:07:18.468: E/ActivityManager(68):   ndroid.launcher: 0% = 0% user + 0% kernel / faults: 261 minor 8 major
12-26 11:07:18.468: E/ActivityManager(68):   .quicksearchbox: 0% = 0% user + 0% kernel / faults: 343 minor 1 major
12-26 11:07:18.468: E/ActivityManager(68):   com.android.mms: 0% = 0% user + 0% kernel / faults: 302 minor 2 major
12-26 11:07:18.468: E/ActivityManager(68):   adbd: 0% = 0% user + 0% kernel
12-26 11:07:18.468: E/ActivityManager(68):   kswapd0: 0% = 0% user + 0% kernel
12-26 11:07:18.468: E/ActivityManager(68):   mmcqd: 0% = 0% user + 0% kernel
12-26 11:07:18.468: E/ActivityManager(68):   vold: 0% = 0% user + 0% kernel / faults: 53 minor 2 major
12-26 11:07:18.468: E/ActivityManager(68):   m.android.phone: 0% = 0% user + 0% kernel / faults: 202 minor
12-26 11:07:18.468: E/ActivityManager(68):  -vold: 0% = 0% user + 0% kernel
12-26 11:07:18.468: E/ActivityManager(68): TOTAL: 100% = 68% user + 31% kernel



this is your error
ANR in edu.mit.appinventor.aicompanion3 (edu.mit.appinventor.aicompanion3/.Screen1)
Reason: keyDispatchingTimedOut

you can find more information after doing a Google serch

what kind of logic are you using in your screen? any complex task?
which device do you use for your tests?
did you test after building your app with the apk file?



yes I test with apk file on my android device
there is no logic at all (blocks board is empty) I just add 22 images (screenshots) and maximum size of all of them is 2.5MB 



I get runtime error
heap size = 40903kb
allocated =24372kb

what does it means



which device do you use for your tests? most probably an older one?
do you have to display all images at the same time in your app?
probably you can reuse an image component and add some logic to your app?



Your link in your post above regarding the SDK utilities points to an expired webpage.



@Don: it seems to be, Tony's website expired, hopefully his site is up and running again soon!



my device is HTC one V4.1.1
I have 10 image components and I use each one of them to display 3 or 2 different images
but it depends on what button I press , when button is pressed former image is change to the new one (set image1.picture to ...)

do you need more info?



It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.



screenshot attached




what you can do is to reduce the image sizes and/or display less images the same time



I must have all images and I succeed to reduce just 200kb and its not enough 
I tried before to upload the image from website link instead to upload the image to app inventor but it takes a long time until picture is display 
(5 sec instead of 1 sec) there is a way to speed it up?


댓글 없음:

댓글 쓰기