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

问题描述 投票:1回答:2

我的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)但我不知道为什么错误发生在这个特定的文件上。

请帮助我们

让我把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'
}
android build nine-patch
2个回答
0
投票

我把我的9补丁文件放在drawable文件夹中,而不是drawable-mdpi等...文件夹。试试看,看看是否有帮助。


0
投票

文件名更改。例如popup_bottom_medium_9.png

© www.soinside.com 2019 - 2024. All rights reserved.