Home > Mobile >  Null Point Reference on Android 12 but not on Android 9
Null Point Reference on Android 12 but not on Android 9

Time:08-21

I am writing a small Android app using Java. Now is there a strange problem that my app runs on Android 9 very well, but crashes on Android 12. My Logcat tells me, Java gets a null pointer Reference at a certain location. To me, this doesn't make any sense. If there was a null pointer reference in my Java code, why would the app work on Android 9 then?

You can find my app activity_tracker file tree

The NullPointerException is caused as the TextView with id textView_characterName is not present in the v31 layout file.

Either delete the second file or make sure ALL the ids and views are consistent across both the files.

  • Related