Android错误:“文件'root / res / drawable-mdpi / popup_bottom_medium.9.png'使用保留的文件或目录名称'res'。”

时间:2019-03-11 06:21:21

标签: android build nine-patch

我的Android项目在生成签名APK时出错,如下所示。

File 'root/res/drawable-mdpi/popup_bottom_medium.9.png' uses reserved file or directory name 'res'.ere

当我制作APK而没有犯错时,它没有出现。

我发现popup_bottom_medium位于android sdk(android-28)中,但是我不知道为什么该特定文件上发生错误。

enter image description here

请帮助我们

让我在我们的代码中加入build.gradle。实际上在这个项目中,我们使用两个自制的库。所以总共我们有三个build.gradle

  1. build.gradle(针对应用本身)
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "xxx.xxx.xxx"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "0.0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(path: ':mylibrary')

    implementation 'com.google.code.gson:gson:2.8.5'

    implementation 'com.parse.bolts:bolts-tasks:1.4.0'
    implementation 'com.parse.bolts:bolts-applinks:1.4.0'
    implementation project(path: ':ERSDKLogin')
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.android.support:design:28.0.0'

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'

    // Measures against compile errors that occur when adding「'com.google.android.gms:play-services-maps:16.0.0' 」
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'

    //graphLibrary
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
}
  1. build.gradle用于库一
    apply plugin: 'com.android.library'

    android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'



    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

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

    // TODO Remove and fix lint issues
    lintOptions {
        abortOnError false
    }

    }

    dependencies {
        api project(':aws-android-sdk-core')
        api project(':aws-android-sdk-cognitoidentityprovider')
        api project(':facebook-common')
        api project(':facebook-core')
        api project(':facebook-login')
        api 'com.google.android.gms:play-services-auth:16.0.1'
        api 'com.squareup.retrofit2:retrofit:2.4.0'
        api 'com.squareup.retrofit2:converter-jackson:2.4.0'
        api 'com.fasterxml.jackson.core:jackson-databind:2.9.5'
        api 'com.squareup.okhttp3:logging-interceptor:3.10.0'
        compileOnly 'org.projectlombok:lombok:1.16.22'
        annotationProcessor 'org.projectlombok:lombok:1.16.22'
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "com.android.support:appcompat-v7:${project.ext.supportLibraryVersion}"
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    repositories {
        flatDir{
            dirs 'libs'
        }
    }
  1. build.gradle(用于第二个库)
apply plugin: 'com.android.library'

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {
    implementation project(':ERSDKLogin')

    compileOnly fileTree(dir: 'libs', include: ['*.jar'])

    testImplementation 'junit:junit:4.12'
    //noinspection GradleCompatible
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'no.nordicsemi.android.support.v18:scanner:1.0.0'
    implementation 'no.nordicsemi.android:dfu:1.6.1'

    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.parse.bolts:bolts-tasks:1.4.0'
    implementation 'com.parse.bolts:bolts-applinks:1.4.0'
    implementation 'com.google.android.gms:play-services-fitness:15.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
}

2 个答案:

答案 0 :(得分:0)

我将9个补丁文件放在drawable文件夹中,而不是drawable-mdpi等文件夹中。尝试一下,看看是否有帮助。

答案 1 :(得分:0)

文件名更改。例如popup_bottom_medium_9.png