Bug? No image in ImageView causes release crash

Computersmith64

Well-Known Member
Licensed User
Longtime User
I discovered this possible bug during development of my latest app. I initially used .png images stored in the Files folder for my icons, but then realized that for the app to be "Designed for tablets" on Google Play, I would need to use resources for the different screen densities - so I went ahead & created images for the various densities & put then in the resource/drawable-[density] folders & changed my code so they would load. Once I'd done that, I removed the original .png files from the Files folder & also set the "Image File" property to nothing in the Visual Designer.

When I compiled & ran the app in Debug mode, it ran fine - however when I did a release build it crashed on startup with a

java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ImageView).

error. After much head scratching & wondering what the hell was going on, I ran a test where I changed the "Image File" property to a random image that was in the Files folder & bingo - no more crash on startup in release mode.

So the question is:

Is it intended that an ImageView created in Visual Designer *must* have an image loaded into it? Or is this a bug? If it's not a bug, why does the app only crash in release mode & not in debug?

- Colin.
 
Top