Android Programming for Beginners

I have started working through Android Programming for Beginners 2nd edition and have installed Android Studio and created my first app (Hello World).

All seems well until I run the app in an AVD when I get hundreds on errors in logcat. I’ve tried different AVDs but they all produce errors. The last time I tried I had nearly 7,000 lines of errors and they were still coming thick and fast after 10 minutes. :nono:

Here are the first few lines:

2019-05-22 10:59:14.843 1637-1637/? E/fsverity_init: Failed to load /product/etc/security/fsverity/*.der
2019-05-22 10:59:14.907 1638-1638/? E//system/bin/mini-keyctl: Cannot find keyring id
2019-05-22 10:59:14.945 1639-1639/? E/fsverity_init: Failed to restrict .fs-verity keyring
2019-05-22 10:59:15.342 1640-1640/? E/apexd: Failed to activate /system/apex/com.android.tzdata : /apex/com.android.tzdata@200000000 is not empty: Success
2019-05-22 10:59:15.355 1640-1640/? E/apexd: Failed to activate /system/apex/com.android.runtime.debug : /apex/com.android.runtime@1 is not empty: Success
2019-05-22 10:59:15.360 1640-1640/? E/apexd: Failed to activate packages from /system/apex : Failed to activate following packages : /system/apex/com.android.tzdata,/system/apex/com.android.runtime.debug
2019-05-22 10:59:15.365 1640-1640/? E/apexd: Failed to activate packages from /product/apex : Failed to scan /product/apex : Can't open /product/apex for reading : generic:2
2019-05-22 10:59:16.473 1652-1652/? A/art_apex: Device is not fsverity-enabled.

Any help appreciated!

1 Like

Okay, so I created a new app and, instead of running it by selecting Tools > AVD manager as the book says, I tried Run > Run app and lo and behold Studio wanted to download yet more files. Once I that was complete the app seemed to run in the emulator, although I was left with “only” 6 errors:

2019-05-22 13:37:04.396 4894-4894/? E/.com.helloworl: Unknown bits set in runtime_flags: 0x8000
2019-05-22 13:37:07.784 4894-4972/webdesignpaciano.com.helloworld E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
2019-05-22 13:37:07.785 4894-4972/webdesignpaciano.com.helloworld E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
2019-05-22 13:37:10.828 4894-4968/webdesignpaciano.com.helloworld E/EGL_emulation: tid 4968: eglQueryString(923): error 0x3008 (EGL_BAD_DISPLAY)
2019-05-22 13:37:10.955 4894-4968/webdesignpaciano.com.helloworld E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2019-05-22 13:37:10.958 4894-4968/webdesignpaciano.com.helloworld E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da

and several errors in the event log all whinging:

13:35	Emulator: C:\Users\userx\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: icmpv6 ICMP6_ECHO_REQUEST failed
2 Likes

I’m glad you posted that solution. I was finding all those errors were not really affecting the building of the sample apps, and the author did mention in his introduction to logcat that we could just disregard those errors for the time being, so because I was in a hurry to just work through the book, I ignored the errors.

The problem was that even if the ‘info’ filter was selected, there were so many lines in the console I found it next to impossible to find any of the messages I logged to the console.

I will definitely try your idea and see if it clears up my logs too.

2 Likes

I have found noticeable differences between the current version of Android Studio and the one used in the book (3.2 I think) which make following the book a little - interesting - at times…

1 Like

I found that also, but the differences were such that it was not too bad working around them. I also find that Android Studio is very very slow on my laptop - something I really would like to solve once I complete this book. For now, I just want to complete the learning as soon as possible so I can move on to actually building some useful apps.

2 Likes

Did you discover a way to rename MainActivity.java as HelloWorldActivity.java @WebMachine? I couldn’t find it anywhere.

I just went to the file explorer and changed the name of that file directly. You can also right-click on the tab above the edit window and change file name there. But it really isn’t necessary to change the name. I think the author was just demonstrating that it could be done. It hasn’t popped up again yet and I am finishing up chapter 13.

There are a few places in the book like that, where the instructions don’t fit the current version of Android Studio, and you have to find a way around it.

1 Like