Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 420
SMBiggs Avatar asked Mar 13 '20 21:03

SMBiggs


People also ask

Where can I find resource ID?

Navigate to your storage account in the Azure portal. On the Overview page, in the Essentials section, select the JSON View link. The resource ID for the storage account is displayed at the top of the page.

How do I find my resource ID Android?

int resourceId = this. getResources(). getIdentifier("nameOfResource", "id", this.

What is a resource ID?

Description The Resource ID field contains the identifier number that Project assigns to each resource. The Resource ID indicates the position of the resource in relation to other resources. How Calculated As you add resources, Project automatically assigns the next number in the sequence of resources as listed.

Is resource ID same as ID?

IDs and Identifiers Despite the similar names, these are not the same thing. A resource ID is the portion of the resource address/URL that comes after the resource type. For example, the resource Patient/123 has the ID of 123.


Video Answer


1 Answers

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.

like image 175
CommonsWare Avatar answered Sep 19 '22 01:09

CommonsWare