[Android Q&A, Help & Troubleshooting] DingDong6:
I have problems with Google Play services after I made couple of small

logging source code changes to Android frameworks files. I have tried

with various GApps packages from BasketBuild.

I have rebuilt CyanogenMod12 20150318 build for hammerhead (Nexus5)

and installed also Google Apps. Everything works fine with unmodified

code. Next I tried to study and debug control flow of Android activities and

process creation by adding log output messages to a couple of class

methods in frameworks/base and recompiled again. Basically everything

still works fine but there is a nasty side effect as Google Play

services start to fail. There is a popup message:

"Unfortunately, Google Play services has stopped"

Obviously my changes are causing these problems but I do not

understand what is happening and why only Google Play services

seem to fail. Seems like modifications to final Java classes like

ActivityRecord, ActivityManagerService, ActivityStackSupervisor are

triggering these problems. I did not add or modify class function

APIs or data members. I just added couple of log prints and tests for

intents. These problems are already present during system setup.

I have to delay network configuration as otherwise this Google Play

error is causing the whole configuration phase to stuck.

Attached logcat log contains many suspicous messages:

1. Two jar files do not exist or contain no resources

The jar files actually are in /system/framework directory but for some

reason the files cannot be used.

2. Insert disabled by gate 'gms:security:enable_conscrypt_in_gms_application'

Google search found couple of postings with this message and there

were hints that this could be a signing key problem. However, I did

not detect any Cyanogenmod instructions and my initial unmodified

build worked with GApps and Google services.

3. Parcel errors when unmarshalling

Class com.google.android.gms.auth.firstparty.shared.AppDescription

not found. This is causing android.os.BadParcelableException

exception.

Any ideas what could cause these problems. Here is extract from log output:

I/ActivityManager( 772): Start proc com.google.android.gms.ui for activity com.google.android.gms/.games.ui.signin.SignInActivity: pid=7978 uid=10022 gids={50022, 9997, 2001, 3003, 1007, 3006, 3007, 3002, 3001, 1028, 1015, 1005} abi=armeabi-v7a

E/Zygote ( 7978): ForkAndSpecializeCommon - name=com.google.android.gms.ui info=release

I/Timeline( 7945): Timeline: Activity_idle id: android.os.BinderProxy@20e35d40 time:7502907

W/ResourcesManager( 7978): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.

W/ResourcesManager( 7978): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.

I/MultiDex( 7978): VM with version 2.1.0 has multidex support

I/MultiDex( 7978): install

I/MultiDex( 7978): VM has multidex support, MultiDex support library is disabled.

I/ProviderInstaller( 7978): Insert disabled by gate 'gms:security:enable_conscrypt_in_gms_application'

D/GCM ( 2484): GcmService start Intent { act=com.google.android.gms.INITIALIZE flg=0x10 pkg=com.google.android.gms cmp=com.google.android.gms/.gcm.GcmService } com.google.android.gms.INITIALIZE

D/AuthorizationBluetoothService( 2484): Received GmsCore event: Intent { act=com.google.android.gms.INITIALIZE flg=0x10 pkg=com.google.android.gms cmp=com.google.android.gms/.auth.be.proximity.authorization.bt.AuthorizationBluetoothService$AutoStarter }.

D/c ( 2484): Getting all permits...

D/a ( 2484): Opening database...

D/LocationInitializer( 2680): Restart initialization of location

D/a ( 2484): Opening database auth.proximity.permit_store...

D/a ( 2484): Closing database...

D/OpenGLRenderer( 7978): Render dirty regions requested: true

D/Atlas ( 7978): Validating map...

I/Adreno-EGL( 7978): <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b

I/OpenGLRenderer( 7978): Initialized EGL, version 1.4

D/OpenGLRenderer( 7978): Enabling debug mode 0

I/ActivityManager( 772): START u0 {act=com.google.android.gms.common.account.CHOOSE_ACCOUNT flg=0x20000000 pkg=com.google.android.gms cmp=com.google.android.gms/.common.account.AccountPickerActivity (has extras)} from uid 10022 on display 0

I/Timeline( 772): Timeline: Activity_windows_visible id: ActivityRecord{3cfb3e37 u0 com.google.android.gms/.games.ui.signin.SignInActivity t13} time:7503232

W/GLSActivity( 2484): [LegacyAuthenticator] The app AppDescription<com.google.android.gms, 10022> is invoking addAccount

W/GLSActivity( 2484): [LegacyAuthenticator] Returning intent launch AccountIntroActivity.

I/Timeline( 7978): Timeline: Activity_launch_request id:com.google.android.gms time:7503308

I/ActivityManager( 772): START u0 {flg=0x80000 cmp=com.google.android.gms/.auth.gsf.AccountIntroActivity (has extras)} from uid 10022 on display 0

I/GLSActivity( 7978): [AccountIntroActivity] Provisioning with name/email. Edu: false

I/GLSActivity( 7978): [AccountIntroActivity] Setup a Google account using GmsCore managed workflow.

I/Timeline( 7978): Timeline: Activity_launch_request id:com.google.android.gms time:7503474

E/Parcel ( 772): Class not found when unmarshalling: com.google.android.gms.auth.firstparty.shared.AppDescription

E/Parcel ( 772): java.lang.ClassNotFoundException: com.google.android.gms.auth.firstparty.shared.AppDescription

E/Parcel ( 772):	at java.lang.Class.classForName(Native Method)

E/Parcel ( 772):	at java.lang.Class.forName(Class.java:308)

E/Parcel ( 772):	at java.lang.Class.forName(Class.java:272)

E/Parcel ( 772):	at android.os.Parcel.readParcelableCreator(Parcel.java:2275)

E/Parcel ( 772):	at android.os.Parcel.readParcelable(Parcel.java:2239)

E/Parcel ( 772):	at android.os.Parcel.readValue(Parcel.java:2146)

E/Parcel ( 772):	at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)

E/Parcel ( 772):	at android.os.BaseBundle.unparcel(BaseBundle.java:221)

E/Parcel ( 772):	at android.os.BaseBundle.containsKey(BaseBundle.java:269)

E/Parcel ( 772):	at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1314)

E/Parcel ( 772):	at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:950)

E/Parcel ( 772):	at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3654)

E/Parcel ( 772):	at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3641)

E/Parcel ( 772):	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:141)

E/Parcel ( 772):	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2476)

E/Parcel ( 772):	at android.os.Binder.execTransact(Binder.java:446)

E/Parcel ( 772): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.firstparty.shared.AppDescription" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

E/Parcel ( 772):	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

E/Parcel ( 772):	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

E/Parcel ( 772):	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

E/Parcel ( 772):	... 16 more

E/Parcel ( 772):	Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.firstparty.shared.AppDescription

E/Parcel ( 772):	at java.lang.Class.classForName(Native Method)

E/Parcel ( 772):	at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

E/Parcel ( 772):	at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

E/Parcel ( 772):	at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

E/Parcel ( 772):	... 17 more

E/Parcel ( 772):	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

F/ActivityManager( 772): Activity Manager Crash

F/ActivityManager( 772): android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.google.android.gms.auth.firstparty.shared.AppDescription

F/ActivityManager( 772):	at android.os.Parcel.readParcelableCreator(Parcel.java:2289)

F/ActivityManager( 772):	at android.os.Parcel.readParcelable(Parcel.java:2239)

F/ActivityManager( 772):	at android.os.Parcel.readValue(Parcel.java:2146)

F/ActivityManager( 772):	at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)

F/ActivityManager( 772):	at android.os.BaseBundle.unparcel(BaseBundle.java:221)

F/ActivityManager( 772):	at android.os.BaseBundle.containsKey(BaseBundle.java:269)

F/ActivityManager( 772):	at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1314)

F/ActivityManager( 772):	at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:950)

F/ActivityManager( 772):	at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3654)

F/ActivityManager( 772):	at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3641)

F/ActivityManager( 772):	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:141)

F/ActivityManager( 772):	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2476)

F/ActivityManager( 772):	at android.os.Binder.execTransact(Binder.java:446)

D/AndroidRuntime( 7978): Shutting down VM

--------- beginning of crash

E/AndroidRuntime( 7978): FATAL EXCEPTION: main

E/AndroidRuntime( 7978): Process: com.google.android.gms.ui, PID: 7978

E/AndroidRuntime( 7978): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.gsf.AccountIntroActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.google.android.gms.auth.firstparty.shared.AppDescription

E/AndroidRuntime( 7978):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2329)

E/AndroidRuntime( 7978):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)

E/AndroidRuntime( 7978):	at android.app.ActivityThread.access$900(ActivityThread.java:147)

E/AndroidRuntime( 7978):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)

E/AndroidRuntime( 7978):	at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime( 7978):	at android.os.Looper.loop(Looper.java:135)

E/AndroidRuntime( 7978):	at android.app.ActivityThread.main(ActivityThread.java:5256)

E/AndroidRuntime( 7978):	at java.lang.reflect.Method.invoke(Native Method)

E/AndroidRuntime( 7978):	at java.lang.reflect.Method.invoke(Method.java:372)

E/AndroidRuntime( 7978):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)

E/AndroidRuntime( 7978):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

E/AndroidRuntime( 7978): Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.google.android.gms.auth.firstparty.shared.AppDescription

E/AndroidRuntime( 7978):	at android.os.Parcel.readException(Parcel.java:1542)

E/AndroidRuntime( 7978):	at android.os.Parcel.readException(Parcel.java:1493)

E/AndroidRuntime( 7978):	at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2414)

E/AndroidRuntime( 7978):	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1480)

E/AndroidRuntime( 7978):	at android.app.Activity.startActivityForResult(Activity.java:3736)

E/AndroidRuntime( 7978):	at android.app.Activity.startActivityForResult(Activity.java:3697)

E/AndroidRuntime( 7978):	at android.support.v4.app.q.startActivityForResult(SourceFile:817)

E/AndroidRuntime( 7978):	at com.google.android.gms.auth.gsf.b.startActivityForResult(SourceFile:660)

E/AndroidRuntime( 7978):	at com.google.android.gms.auth.gsf.b.a(SourceFile:513)

E/AndroidRuntime( 7978):	at com.google.android.gms.auth.gsf.AccountIntroActivity.i(SourceFile:358)

E/AndroidRuntime( 7978):	at com.google.android.gms.auth.gsf.AccountIntroActivity.d(SourceFile:213)

E/AndroidRuntime( 7978):	at com.google.android.gms.auth.gsf.AccountIntroActivity.onCreate(SourceFile:188)

E/AndroidRuntime( 7978):	at android.app.Activity.performCreate(Activity.java:5933)

E/AndroidRuntime( 7978):	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)

E/AndroidRuntime( 7978):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)

E/AndroidRuntime( 7978):	... 10 more

W/ActivityManager( 772): Force finishing activity com.google.android.gms/.auth.gsf.AccountIntroActivity

W/ActivityManager( 772): Force finishing activity com.google.android.gms/.common.account.AccountPickerActivity

W/DropBoxManagerService( 772): Dropping: system_server_wtf (1497 > 0 bytes)

W/DropBoxManagerService( 772): Dropping: system_app_crash (2410 > 0 bytes)