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

谁都会走 提交于 2019-12-11 07:57:36

问题


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:-)


回答1:


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.



来源:https://stackoverflow.com/questions/38372983/you-need-to-use-a-different-package-name-because-com-example-is-restricted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!