Search code examples
androidandroid-studiodebuggingandroid-resourcesr.java-file

How to find resource ID #s now that Android Studio no longer creates R.java?


I am trying to debug the following warnings:

03-13 16:27:13.248 6636-6636/sleepfuriously.com.warningtest W/Resources: Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f09002a}
03-13 16:27:13.248 6636-6636/sleepfuriously.com.warningtest W/Resources: Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f090028}

(26 more similar cut for brevity)

It looks like I am using some resource as a String which should be something else. Normally I'd just pull open the R.java file and see what these numbers refer to and voila, there are the problem resources.

But the new version of Android Studio bypasses creation of R.java. So I have no way of knowing which resources are causing these warnings. Any clue on how to debug this?


Solution

  • While tedious, you could use the APK Analyzer in Android Studio. You can get to this via Build > Analyze APK from the main menu.

    After choosing your APK, click on the resources.arsc entry in the upper pane. This will then give you a lower pane showing you the different resource types. Selecting a type gives you the resources for that type, including the hex value for the resource ID:

    APK Analyzer in Android Studio

    There is no search-by-resource-ID option, but you could rummage through the resources and try to find out where these IDs are coming from.