title: minifyEnabled causing app to crash on release mode
body: <p>My application was working fine on Debug mode. Unfortunately after uploading to Google Play Store I found that the app is crashing. I searched several similar questions all of which suggested to disable <strong>Proguard</strong> or check the Log outputs. However I have come across the following cases when using the <strong>release</strong> Build Variant:</p>
  
  <p><strong>1-</strong> In normal case when <code>minifyEnabled</code> is <code>true</code> the app crashes and I am not able to see any Log outputs. There are <strong>No Debuggable Processes</strong>.</p>
  
  <pre class="lang-java prettyprint-override"><code>release {
              shrinkResources true
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.config
          }
  </code></pre>
  
  
  
  <p><strong>2-</strong> Making <code>debuggable true</code> my app works fine. But again I am not able to see any error Logs because the app is working fine.</p>
  
  <pre class="lang-java prettyprint-override"><code>release {
              debuggable true
              shrinkResources true
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.config
          }
  </code></pre>
  
  
  
  <p><strong>3-</strong> Commenting <code>minifyEnabled true</code> the app works. But I lose minification benefits. </p>
  
  <pre class="lang-java prettyprint-override"><code>release {
              shrinkResources true
              //minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.config
          }
  </code></pre>
  
  
  
  <p>Also tried hardcoding <code>android:debuggable="true"</code> in AndroidManifest.XML which gives error.</p>
  
  <p>The strange thing is that by setting debuggable to true the app works fine. I am not sure whether I should keep <code>debuggable true</code> in the release mode or disable minification, Or any other workaround to tackle this issue.</p>
  
  <p>I will be very grateful if anyone could share how to solve this problem.</p>
  
  <p><strong>UPDATE:</strong> by running <strong>Android Device Monitor</strong> I was able to find the problem:</p>
  
  <pre><code>01-28 00:28:13.764: E/AndroidRuntime(4806): FATAL EXCEPTION: main
  01-28 00:28:13.764: E/AndroidRuntime(4806): Process: com.example.myapp, PID: 4806
  01-28 00:28:13.764: E/AndroidRuntime(4806): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setSearchableInfo(android.app.SearchableInfo)' on a null object reference
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at com.example.myapp.MainActivity.onCreateOptionsMenu(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.app.Activity.onCreatePanelMenu(Activity.java:3142)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v4.b.n.onCreatePanelMenu(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v7.view.i.onCreatePanelMenu(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v7.app.h$b.onCreatePanelMenu(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v7.view.i.onCreatePanelMenu(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v7.app.q.j(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.support.v7.app.q$1.run(Unknown Source)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.os.Handler.handleCallback(Handler.java:739)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.os.Handler.dispatchMessage(Handler.java:95)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.os.Looper.loop(Looper.java:148)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at android.app.ActivityThread.main(ActivityThread.java:7329)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at java.lang.reflect.Method.invoke(Native Method)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  01-28 00:28:13.764: E/AndroidRuntime(4806):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  </code></pre>