I installed a fresh copy of Cyanogenmod 13 on my Nexus 4, and attempted to install Open GApps.

However, I was repeatedly presented with the errors: “SetupWizard has stopped working” and “Google Play Services has stopped working”.

I found the fix for SetupWizard here: http://www.deseret-tech.com/journal/cyanogenmod-13-nightly-setupwizard-has-stopped-working/

The solution is to run adb shell to get shell access on the device, then to run the following to allow Google’s setup wizard to have the READ_PHONE_STATE permission.

pm grant com.google.android.setupwizard android.permission.READ_PHONE_STATE

Figuring the Google Play Services would be similar, I made sure USB debugging was enabled and ran adb logcat on my machine to see what the error was:

09-04 12:31:58.015  5273  5337 E AndroidRuntime: FATAL EXCEPTION: GoogleLocationService
09-04 12:31:58.015  5273  5337 E AndroidRuntime: Process: com.google.android.gms.persistent, PID: 5273
09-04 12:31:58.015  5273  5337 E AndroidRuntime: Theme: themes:{}
09-04 12:31:58.015  5273  5337 E AndroidRuntime: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1620)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1573)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.location.ILocationManager$Stub$Proxy.addGpsStatusListener(ILocationManager.java:741)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.location.LocationManager.addGpsStatusListener(LocationManager.java:1537)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at afuq.a(:com.google.android.gms:1048)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at afre.b(:com.google.android.gms:6334)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at afre.handleMessage(:com.google.android.gms:278)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
09-04 12:31:58.015  5273  5337 E AndroidRuntime:        at android.os.HandlerThread.run(HandlerThread.java:61)

Following the same rough logic as the SetupWizard issue, I can see that com.google.android.gms wants ACCESS_FINE_LOCATION.

So, I ran the following in adb shell

pm grant com.google.android.gms android.permission.ACCESS_FINE_LOCATION

and voila!