Search code examples
android-studiogoogle-playdomain-name

You need to use a different package name because "com.example" is restricted


I have found a lot of threads about this issue here already, but none of them are working for me.

I am using Android Studio 2.1.2, and I still have the com.example domain name. Changing it in the manifest or any other file is causing a score of errors appearing, and my build.gradle only shows this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Can somebody please offer me some advice as I have spent a lot of time on this app already? Thanks in advance:-)


Solution

  • what you have shown in your question is the top-level build.gradle.

    open the app level build.gradle (inside the app folder) and change the package name against applciationId

    you dont need to change the package name everywhere in your code. Just changing it here will generate your apk with the provided package name irrespective of how your packages in the src folders are named.