添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

So, now to find your generated resource classes you need the following steps:

1) Open your project.

2) Go to your module build path.

3) Open the outputs/apk/debug/app-name-debug.apk file.

4) Choose your classes.dex file.

5) Look at the down placed area and go to your full package path.

6) You can see all bytecoded resource classes. So, scroll down to what you are looking for.

7) Expand the resource class you need to proceed (for example, let it be R.id)

8) Go to you id's.

That's it.

UPDATE:

If you would like to see actual id integer number you should follows steps below:

1) By (7) Go to the resource class you need to proceed and right click to show the context menu

2) Choose "Show Bytecode" to see the flexible dialog "DEX Byte Code for R$id", for example, for id class

3) Scroll down to the actual id to look its number

That's the correct answear in 2020 (Android Studio 3.6), but how can I read actual id? like button17 = 52444873 ? Karol Żygłowicz Apr 8, 2020 at 15:39 if somebody wonders: "The new Android Gradle Plugin generates the corresponding bytecode directly and does not make the intermediate R.java file." forums.bignerdranch.com/t/… bomben Apr 12, 2020 at 8:00 Also look at classes2.dex and classes3.dex for your package. If you search an id , probably you won't find it there, because it can belong to another package. See stackoverflow.com/a/61277205/2914140 for a short way. CoolMind Sep 23, 2020 at 9:48 For me, selecting resources.arsc in the APK gave me a table with the type of resource (id, drawable, color, attr, etc) on the left and on the right the ID shown in the Crash and the Name of the resource. Benny Feb 12 at 21:31

Although the current Android Gradle Plugin doesn't generate a R.java anymore you can still inspect the corresponding class file (see Sergey V.`s answer).

However, if you (like probably in most cases) just want to look up the generated IDs for your resources, there is an easier way:

In the project pane on the left hand side switch from Android to Project view using the drop-down at the top. Then navigate to app/build/intermediates/runtime_symbol_list/<insert build type here>/R.txt . This file lists all IDs generated by AGP during the build process.

As noted above, "The new Android Gradle Plugin generates the corresponding bytecode directly and does not make the intermediate R.java file".

Using the ubuntudroid solution you can find an id also this way. Find R.txt and copy absolute path. Project > app > build > intermediates > runtime_symbol_list > debug > R.txt. Then right click and select Copy Path... , 1. Absolute Path Ctrl+Shift+C .

This way you will obtain a path to R.txt , for instance, "C:\Users\user\AndroidStudioProjects\your_project\app\build\intermediates\runtime_symbol_list\debug\R.txt". Copy the path without R.txt to a text file for future references, for example, with Notepad++.

Press Ctrl + Shift + F to find in directory. Insert an id and the path.

== Old answer ==

Change a project view from Android to Project or Project Files . Find one of these two files.

Then you can revert back to Android view.

I feel sorry for the OP. I seriously doubt he/she was asking for a screenshot of the actual R file. The answer should clearly explain how it is generated as well. Rakib Jan 3, 2019 at 7:46

R.java is the generated file by ADT or Android studio. It will be located under app\build\generated\source\r directory.

./app/build/generated/source/r/debug/android/support/v7/appcompat/R.java
./app/build/generated/source/r/debug/your/packagename/name/R.java
                there is no directory called r under source. see other answers - the source is no longer generated, only bytecode, if your AGP version is 3.6 or above.
– Adam Burley
                Sep 29, 2022 at 14:46

I am using Android Studio 2.2.3 , the R.java file is shown in the picture below. Goto in the left upper side there is a selecting list ,

  • select [package]
  • Open "App Folder"
  • com.example.saeedanwar.myapplication;
  • If you're using Mac or Linux, try the following command line on your terminal:

    find . -name "R.*"
    

    It will print something like:

    ./app/build/intermediaries/runtime_symbol_list/debug/R.txt
    ./app/build/intermediaries/compile_and_runtime_not_namespaced_r_class_jar/debug/R.jar
    

    This answer will be in a constant state of flux until Android standardize a method of matching their annoying decimal/hexadecimal id references to a tangible resource such as my_layout.xml.

    For Android Studio Dolphin | 2021.3.1 Patch 1 have a look at this file:

    /project/package/build/intermediates/stable_resource_ids_file/debug/stableIds.txt
    

    It is produced by RUN (not just BUILD). Sample:

    layout/mtrl_picker_header_fullscreen = 0x7f0d00de
    string/cancel = 0x7f1101f0
    style/ThemeOverlay.MaterialComponents.MaterialCalendar = 0x7f1202f3
    id/gpxBtn = 0x7f0a0346
            

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.