title: Android Studio - Change applicationId in build.gradle file
body: <p>How can I change the <code>applicationId</code> field of my <code>build.gradle</code> file?</p>
  
  <pre><code>defaultConfig {
      applicationId "com.oldname.appname"
      minSdkVersion 15
      targetSdkVersion 23
      versionCode 1
      versionName "1.0"
  }
  </code></pre>
  
  <p>I've already renamed the package structure to <code>com.newname.appname</code> and all the imports and things like that have updated, but <code>applicationId</code> hasn't. I can't refactor it and just trying to type in a new name brings up a ton of errors where Android Studio will tell me my main <code>FragmantActivity</code> "is not applicable to android.app.Activity" and so on.</p>
  
  <p>Any idea what to do? Thanks in advance.</p>