java.lang.NoClassDefFoundError: android.provider.Settings$Global
test-butler 1.4.0 crashes on a emulator with SDK level 15 with:
I/ActivityManager( 1259): Start proc com.linkedin.android.testbutler for service com.linkedin.android.testbutler/.ButlerService: pid=1784 uid=1000 gids={1015, 3002, 3001, 3003}
E/AndroidRuntime( 1784): FATAL EXCEPTION: main
E/AndroidRuntime( 1784): java.lang.NoClassDefFoundError: android.provider.Settings$Global
E/AndroidRuntime( 1784): at com.linkedin.android.testbutler.AlwaysFinishActivitiesChanger.getAlwaysFinishActivitiesState(AlwaysFinishActivitiesChanger.java:62)
E/AndroidRuntime( 1784): at com.linkedin.android.testbutler.AlwaysFinishActivitiesChanger.saveAlwaysFinishActivitiesState(AlwaysFinishActivitiesChanger.java:39)
E/AndroidRuntime( 1784): at com.linkedin.android.testbutler.ButlerService.onCreate(ButlerService.java:153)
E/AndroidRuntime( 1784): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
E/AndroidRuntime( 1784): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
E/AndroidRuntime( 1784): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
E/AndroidRuntime( 1784): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1784): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1784): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 1784): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1784): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1784): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 1784): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 1784): at dalvik.system.NativeStart.main(Native Method)
Might need to either access through reflection or bump minSdkVersion to 17. https://github.com/linkedin/test-butler/blob/d770acf39f6373c3b7c6cf79b68ccd78868f4983/build.gradle#L25
please do not bump minSdkVersion to 17 - for me that would mean I need to stop using it.
I can see that there are two lines that would need to be accessed using reflection or an API check:
https://github.com/linkedin/test-butler/blob/d770acf39f6373c3b7c6cf79b68ccd78868f4983/test-butler-app/src/main/java/com/linkedin/android/testbutler/AlwaysFinishActivitiesChanger.java#L62 https://github.com/linkedin/test-butler/blob/d770acf39f6373c3b7c6cf79b68ccd78868f4983/test-butler-app/src/main/java/com/linkedin/android/testbutler/AlwaysFinishActivitiesChanger.java#L57
Can you see any others? I am surprised this didn't get flagged up in the lint check.
Need to replace the call for <17 with: https://developer.android.com/reference/android/provider/Settings.System.html#ALWAYS_FINISH_ACTIVITIES
@ligi would you be able to cook up a PR with an API check that calls the appropriate settings method: either Settings for API <17 and Settings.Global for API 17>=?
Yes I am able - but I won't have time for this the next 2 months at minimum. My workaround now is to use test-butler 1.3.2 which works for me. This was just introduced with 1.4.0 via https://github.com/linkedin/test-butler/commit/9aa710c07df72e684d0163191ff43a3be4a6fe06 - cc @kurtzmarc @drewhannay
Strange - this wasn't picked up in lint. I don't see a warning in AS. I'll whip up a fix.
@kurtzmarc Ah, this is why! https://github.com/linkedin/test-butler/blob/d770acf39f6373c3b7c6cf79b68ccd78868f4983/test-butler-app/src/main/java/com/linkedin/android/testbutler/AlwaysFinishActivitiesChanger.java#L27
Ah. That was C&P from another class. Really should be removed.