Error: ':' is not a valid resource name

I imported the eclipse project into android studio.I googled but did not get the correct answer. These errors occur -

D:\***\app\src\main\res\values\strings.xml
Error:Error: ':' is not a valid resource name character
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> D:\****\app\src\main\res\values\strings.xml: Error: ':' is not a valid resource name character

The code of my gradle application

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.******.***"
        minSdkVersion 21
        targetSdkVersion 22
        multiDexEnabled true     }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories { mavenCentral() }

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/httpmime-4.1.1.jar')
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/ormlite-core-4.43.jar')
}

Please resolve my problem. thank you

+6
source share
4 answers

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

means you have a resource name e.g.

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

but a colon is not allowed.

Try the following:

  • Open string.xml

  • Type Ctrl+ F(in Win / Linux)

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

  • Remove the colon and replace it with an underscore if necessary _

  • Compile apk

+8
source

compile 'com.android.support:design:23.1.1' , "-"

0

break, :

Error: break is not a valid resource name (reserved Java keyword)
0

, , "@id/android: foo". "@+id/foo" .

AGP 3.3.

regexp = "@+ [^"]: [^ "]" .

0

Source: https://habr.com/ru/post/1627561/


All Articles