Android Studio R.java

前端 未结 6 2057
太阳男子
太阳男子 2021-02-05 12:35

I\'m seeing a crash on an older device that works on multiple newer devices:

android.content.res.Resources$NotFoundException: Resource ID #0x7f030035


        
相关标签:
6条回答
  • 2021-02-05 13:13

    [SOLVED] LOCATION OF R.JAVA file in Android Studio 1.3.1 is as follows:

    In Android Studio, go to the Project Window (usually on the left-hand side pane:

    1. Right-click on the node, app
    2. Click on "Show In Explorer". This will open the actual directory/location of your project.
    3. The path of the R.java file in this directory is as follows: app\build\generated\source\r\debug\com\sg\calculator
      (Since, I used the package name com.sg.calculator for my project, hence, I had to go inside the folder com\sg\calculator. This will be obviously different for your project).
    0 讨论(0)
  • 2021-02-05 13:15

    Android Studio (Preview) 0.5.9

    If you are using Android Studio (Preview) 0.5.9 and the new Gradle build tool you can find the default R.java in your IDE here:

    build/source/r/release/com/google/android/gms/R.java
    

    and your own here:

    build/source/r/release/com/company/android/R.java
    
    0 讨论(0)
  • 2021-02-05 13:16

    So this took a lot of trial and error and google searches but finally have cracked it. After renaming your Android Project in

    • File --> Project Structure, go to Android Manifest and rename the package manually. Then close Android Studio.

    • Go to your Android project in the explorer, then App --> src --> main --> java --> com. Here, rename the folder companyname to your new companyname.

    • Open this folder, and rename the gamename folder to your gamename, in the same format and spelling as you did in Project Structure. Now open Android Studio again.

    • Go to App --> java --> com --> companyname.gamename (this should be showing as the name you gave it in the explorer). Open PTPlayer and manually update the package name to the new package name.

    • This should resolve your problem of Cannot REsolve R

    0 讨论(0)
  • 2021-02-05 13:27

    In Android Studio 3.4 and above that the R.java file is under

    Project/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResourc/r/com/{app package name} / R. java

    0 讨论(0)
  • 2021-02-05 13:32

    In Android Studio 1.1.0 the R.java file is under

    Project/app/build/generated/source/r/debug/com.android.'projectname'/R.java

    If you don't see the above collection of folders, clean and build the project first. It takes a few minutes and you'll see Gradle running at the bottom of the IDE.

    0 讨论(0)
  • 2021-02-05 13:38

    May be try thus.

    Goto File -> Settings -> Compiler now check use external build

    then rebuild project

    0 讨论(0)
提交回复
热议问题