app install issues on versions after 2.3
<p>my app checks whether there is a screen lock pattern on the device and whether passwords are visible, using the android.provider.Settings.Secure and android.provider.Settings.System API.</p>

<p>the app crashes on initial install on <code>3.0, 3.2, 4.0 and 4.1</code> under specific conditions. </p>

<p>1) if i install on 3.0, 3.2, 4.0 with screen lock pattern set and the setting 'passwords visible' unchecked, all goes well. after initial install, change settings, close app, all runs and checks perfectly. but if either of the two settings dont comply during install it crashes.</p>

<p>2) on 4.1, its a similar case, except it requires only visible passwords to be disabled. no condition on screen lock.</p>

<p>after it installs once, it reinstalls okay wd any device setting after an uninstall</p>

<p>here is the log file:</p>

<pre><code>&gt; 10-11 17:08:00.624: I/dalvikvm(428): Could not find method android.app.KeyguardManager.isKeyguardSecure, referenced from method com.example.android_compliance.MainActivity.password
10-11 17:08:00.696: W/dalvikvm(428): VFY: unable to resolve virtual method 58: Landroid/app/KeyguardManager;.isKeyguardSecure ()Z
10-11 17:08:00.696: D/dalvikvm(428): VFY: replacing opcode 0x6e at 0x0015
10-11 17:08:01.054: D/dalvikvm(428): GC_FOR_ALLOC freed 59K, 4% free 6380K/6599K, paused 44ms
10-11 17:08:01.054: I/dalvikvm-heap(428): Grow heap (frag case) to 6.810MB for 513744-byte allocation
10-11 17:08:01.134: D/dalvikvm(428): GC_FOR_ALLOC freed 8K, 4% free 6873K/7111K, paused 51ms
10-11 17:08:01.214: D/dalvikvm(428): GC_CONCURRENT freed &lt;1K, 4% free 6873K/7111K, paused 3ms+2ms
10-11 17:08:01.385: D/AndroidRuntime(428): Shutting down VM
10-11 17:08:01.385: W/dalvikvm(428): threadid=1: thread exiting with uncaught exception (group=0x40014760)
10-11 17:08:01.394: E/AndroidRuntime(428): FATAL EXCEPTION: main
10-11 17:08:01.394: E/AndroidRuntime(428): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.example.android_compliance/com.example.android_compliance.MainActivity}: java.lang.NullPointerException
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread.access$1500(ActivityThread.java:123)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.os.Looper.loop(Looper.java:126)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread.main(ActivityThread.java:3997)
10-11 17:08:01.394: E/AndroidRuntime(428):  at java.lang.reflect.Method.invokeNative(Native Method)
10-11 17:08:01.394: E/AndroidRuntime(428):  at java.lang.reflect.Method.invoke(Method.java:491)
10-11 17:08:01.394: E/AndroidRuntime(428):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
10-11 17:08:01.394: E/AndroidRuntime(428):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
10-11 17:08:01.394: E/AndroidRuntime(428):  at dalvik.system.NativeStart.main(Native Method)
10-11 17:08:01.394: E/AndroidRuntime(428): Caused by: java.lang.NullPointerException
10-11 17:08:01.394: E/AndroidRuntime(428):  at **com.example.android_compliance.MainActivity.onCreate(MainActivity.java:337)**
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
10-11 17:08:01.394: E/AndroidRuntime(428):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
10-11 17:08:01.394: E/AndroidRuntime(428):  ... 11 more
</code></pre>

<p>the method pointed to in the logs is the one that checks for a screen lock</p>
