Android Studio don't generate R.java for my import project

后端 未结 23 1742
天命终不由人
天命终不由人 2020-12-29 04:20

I import a project to Android Studio , but the R.java is always empty.

public final class R {
}

I have tried:

  1. Make project,ma
23条回答
  •  醉酒成梦
    2020-12-29 04:33

    I will answer the question even though it has been a long time since it was thrown, just in case someone else get to it.

    Tested on Android Studio ONLY (but I guess it could work for Eclipse as well) :

    Check your build/source/r folder. In there, you should find some directories labelled under the name of your gradle build name (default : debug). Verify that the name of the package associated with R is the one you want.

    I know this trick solves the problem of switching namespace, because Android Studio (or Gradle I don't know who is responsible for that) seems not to regenerate it in that case.

    I haven't tried it when importing a project from Eclipse though.

提交回复
热议问题