调试设备时Android资源编译失败

时间:2019-08-01 02:20:53

标签: android android-studio

当我将代码调试到设备时,我遇到了一些问题。错误显示如下:

Android resource compilation failed
/Users/agungnugroho/Downloads/AndroidStudioProjects/Version 3.0/hris/
app/build/intermediates/incremental/mergeDebugResources/merged.dir/
values/values.xml:4: error: unknown tag <:string>.
/Users/agungnugroho/Downloads/AndroidStudioProjects/Version 3.0/
hris/app/build/intermediates/incremental/mergeDebugResources/
merged.dir/values/values.xml:5: error: unknown tag <:string>.
/Users/agungnugroho/Downloads/AndroidStudioProjects/Version 3.0/
hris/app/build/intermediates/incremental/mergeDebugResources/
merged.dir/values/values.xml: error: file failed to compile.

当我添加库并在此处添加我的 build.gradle 代码时,就会发生这种情况:

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "id.co.poslogistics.hris"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "0.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation "com.android.support:support-compat:26.0.0"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.squareup.picasso:picasso:2.4.0'
    implementation 'com.github.bumptech.glide:volley-integration:1.4.0'
    implementation 'io.jsonwebtoken:jjwt:0.6.0'
    implementation 'com.koushikdutta.ion:ion:2.1.7'
    implementation 'com.google.android:flexbox:0.2.5'
    implementation 'com.github.bumptech.glide:glide:3.5.2'
    implementation 'com.jakewharton:butterknife:8.5.1'
    implementation 'com.android.support:design:26.0.0'
    implementation 'com.github.gcacace:signature-pad:1.2.1'
    implementation 'org.apache.httpcomponents:httpcore:4.4.9'
    implementation 'com.google.android.gms:play-services-location:9.6.1'
    implementation 'com.google.android.play:core:1.6.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}

任何人都可以帮助我,因为我不明白那个错误吗?

2 个答案:

答案 0 :(得分:1)

values.xml文件中的标签应以<string>开头,而不是<:string>

答案 1 :(得分:0)

我检查我的 value.xml ,因为调用方法错误