Skip to content Skip to sidebar Skip to footer

Error: ':' Is Not A Valid Resource Name Character

I have imported my eclipse project to android studio.I googled but not getting right answer. These errors are occurred- D:\***\app\src\main\res\values\strings.xml Error:Error: ':'

Solution 1:

Error: ':' is not a valid resource name character

means that you have a resource name like

<string name="not:valid">Foobar</string>

but colon are not allowed.

Try this:

  • Open your string.xml

  • Type Ctrl + F (on Win/Linux)

  • Check Regex and search by "[A-Za-z_]*:[A-Za-z_]*"

  • Remove colon and if necessary replace with an underscore _

  • Compile your apk

Solution 2:

In my case there were a few layout unfortunately using ids of the form "@id/android:foo". Turning them into "@+id/foo" solved the issue.

This happened when upgrading to AGP 3.3.

You can search for the regexp ="@\+[^"]*:[^"]*" in your layout folder.

Solution 3:

Actually you can't even have name like break because you will get similar error from compiler:

Error: breakis not a valid resource name (reserved Java keyword)

Solution 4:

compile 'com.android.support:design:23.1.1' I think you should try "-" instead of colon after design

Post a Comment for "Error: ':' Is Not A Valid Resource Name Character"