【Android】报错 ‘R‘ is not a valid file-based resource name character: File-based resource names must

Error message:

Result graph

‘R’ is not a valid file-based resource name character: File-based resource names must

reason

This error message indicates that in the Android project, the file name or resource name contains the illegal character 'R'. Android file names and resource names can only contain lowercase letters az, numbers 0-9, or underscores.

To solve this problem, you need to check the file names and resource names in the project to ensure that they comply with the above rules. Specifically, find files or resources that contain the 'R' character and change them to valid characters that contain only lowercase letters, numbers, or underscores. For example, change the file name from "MyResource.java" to "my_resource.java".

This error usually occurs when naming resources with incorrect naming conventions, so please check your code and resource files carefully to ensure that all file names and resource names comply with Android naming rules.

Solution

Find the file path that prompted the error and look at the naming: is it named in camel case? If it is a big hump, change the uppercase letters to lowercase

Summarize

The names in the adapter file must all be lowercase and use _ to distinguish them.

Guess you like

Origin blog.csdn.net/KJJfighting/article/details/132228904