Android Studio gets package name wrong when running .apk

I tried to restart Android Studio but the problem still existed.

Then the solution works with me.

  1. Remove the directory ~/.gradle/caches/. It’s OK to do this while Android Studio is opened.
    (Refer pm installing wrong package name)
  2. Press “Sync project with Gradle files” icon on Android Studio
  3. Run the project and the remote path will be correct.

Here is how I solved it. Very simple.

Click the ‘Sync Project with Gradle Files’ button at the top of the window.

'Sync Project with Gradle Files' button screenshot

Look for this button if you’re using newer version of Android Studio:

'Sync Project with Gradle Files' button in newer AS screenshiot

'Sync Project with Gradle Files' button in latest AS screenshiot

I Did all mentioned things but no effect. Then I found something in build.gradle file and changed it as per my new package. It worked for me.

    defaultConfig {
    applicationId "com.*****.newPackageId"
    minSdkVersion 11
    targetSdkVersion 20
}

Leave a Comment