Canvas: trying to draw too large

Hi dears appinventors!!!!
Yesterday I upload my app to google play console and y have an error

java.lang.RuntimeException: Canvas: trying to draw too large(161346240bytes) bitmap.

how can I solve this problem???????????:cry:

1 Like

Can you post a screenshot of your code or something?

2 Likes

https://1drv.ms/u/s!AqPtQVRfteVThahgfiMslKKGHzYZJw?e=Z5jcl1

THIS IS THE AIA FILE

1 Like

If I'm not wrong, the file size is about 161 MB, which obviously is over the 30 MB limit.

1 Like

2021-12-22

The app file is 18.0MB

1 Like

It took more than 1 minute for the system to load the AIA into AI2, which means the file is quite large. What server are you using? code.appinventor.mit.edu or ai2.appinventor.mit.edu?

1 Like

File name: Elena_y_Tonito.apk

File size: 23.3 MB

That's strange.

1 Like

The only screen the Canvas appeared was TABLERO, and from your APK, it completely works. However, I noticed that you have a lot of assets - more than 100 files.

Are you sure the app you published to Google Play is the exact same app you posted?

If they still don't work, please read these links and topics.

2 Likes

The file size is 18.1 MB for me, but 161346240 bytes is around 154 MB, which means something is not right.
To be honest, I know little about this topic, but I googled the error description and found these:


(not very relevant link from what I can see, but it is top 3 result)

(5 years 4 months ago, but it's Stack Overflow I guess?)

(Android studio)

If I had to guess, I think your problem is that you are trying to draw a file that is either way too large or way too detailed for the screen size. I would suggest making any images you're using much smaller.

1 Like

Try instead of publishing an APK to Google Play, use an AAB.

You're not the first person to encounter this problem before, some of us also had this issue.

1 Like

@Gordon_Lu is more qualified; I wasn't even able to open the file. My last parting words of wisdom are "make sure you don't have any very large images"

2 Likes

Try to remove some big files that you do not need.

Asset limit for APK: < 10 MB, better < 5 MB

Asset limit for AAB: < 20 MB, better < 5 MB

1 Like

I saw the same blogs.

They say that is a problem in android, android try to resize the image and that close the app.

somebody recomend to use this code
android:hardwareAccelerated="false"
How can i put this code on app inventor?

1 Like

In some mobiles the app close the first time and the second is running normaly, I use the abb on play console, google doesnt work with apk anymore

2 Likes

The problem is not the files, the problem is the first app run

1 Like

You can't I believe; those people are working with Android Studio, which is a different platform altogether (a very similar one though).

1 Like

As Gordon said, try using (packaging and publishing as) an AAB instead of an APK and see if that works.

3 Likes

i already use the aab file.

1 Like

Well then I'm not sure what to do; I'd wait and see if someone else responds

2 Likes

I guess the main reason is still the assets, so it affects the first time loading but the second time is OK. Installing an app on Google Play does have some differences than directly downloading the app through the build QR code.

Meanwhile, I noticed that some of your images were text that could be easily replaced with the Label component, and sound files that could be replaced.with TextToSpeech. Please use built-in components to replace them.

Also don't forget that you can use a URL as a source for Images, Players and Sounds. You can upload a sound or image file in Google Drive, share it so that anyone on the web can view, and copy the share link. In you blocks (not in the Designer), set the Image/Player/Sound 's Picture/Source to the URL.

3 Likes