Android APK сгенерирован с помощью Android Studio отсутствует файл MANIFEST.MF - PullRequest
0 голосов
/ 13 апреля 2020

У меня есть android проект с использованием android studio 3.6.1. Когда я генерирую apk из Android Studio, в созданном APK-файле отсутствует файл META-INF / MANIFEST.MF. Однако, когда я собираю apk через консоль, все работает правильно.

Я не уверен, какие настройки в build.gradle контролируют создание этого файла и когда он создается. Любая помощь в этом отношении будет принята с благодарностью.

В моем файле build.gradle



    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09'
            classpath 'com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09'
        }
    }

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'kotlin-android-extensions'
    apply from: '../config/quality.gradle'
    apply plugin: 'com.github.spotbugs'

    project.extensions.extraProperties.set('SpotBugsTask', com.github.spotbugs.SpotBugsTask)

    // loads the current project's local settings file
    Properties localProperties = new Properties()
    def localPropertiesFile = project.file('../local.properties')
    if (localPropertiesFile.exists()) {
        localProperties.load(new FileInputStream(localPropertiesFile))
        localProperties.list(System.out)
    }

    android {
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
        tasks.withType(Test) {
            // pass the proxy configuration to the gradle test executor
            systemProperty "http.proxyHost", System.getProperty('http.proxyHost')
            systemProperty "http.proxyPort", System.getProperty('http.proxyPort')
            systemProperty "http.proxyUser", System.getProperty('http.proxyUser')
            systemProperty "http.proxyPassword", System.getProperty('http.proxyPassword')
            systemProperty "https.proxyHost", System.getProperty('https.proxyHost')
            systemProperty "https.proxyPort", System.getProperty('https.proxyPort')
            systemProperty "https.proxyUser", System.getProperty('https.proxyUser')
            systemProperty "https.proxyPassword", System.getProperty('https.proxyPassword')
        }

        def appName = "app_name"
        def appIdSuffix = ""
        if (project.hasProperty('appSuffix') && appSuffix ==~ /^[a-zA-Z0-9]*$/) {
            println("Appending suffix: " + appSuffix)
            appIdSuffix = appSuffix
        }

        compileSdkVersion parent.ext.androidCompileSdkVersion
        buildToolsVersion parent.ext.androidBuildToolsVersion

        testOptions {
            unitTests {
                includeAndroidResources = true
            }
            animationsDisabled = true
            unitTests.returnDefaultValues = true
            unitTests.all {
                maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
                systemProperty "testResponse", "${projectDir}/src/testServerDebug/res/raw"
                testLogging {
                    showStackTraces = true
                    exceptionFormat = "full"
                    events 'passed', 'failed', 'skipped'
                }
                maxHeapSize = "4g"
            }
            execution 'ANDROIDX_TEST_ORCHESTRATOR'
        }

        android {
            lintOptions {
                warning "TrustAllX509TrustManager"
            }
        }

        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
            main.java.srcDirs += 'src/production/kotlin'
            main.java.srcDirs += 'src/server/kotlin'
            test.java.srcDirs += 'src/test/kotlin'
            test.java.srcDirs += 'src/testServerDebug/kotlin'
            test.java.srcDirs += 'src/testServerDebug/java'
            androidTest.java.srcDirs += 'src/androidTest/kotlin'
        }

        packagingOptions {
            exclude 'LICENSE.txt'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/services/javax.annotation.processing.Processor'
            exclude 'META-INF/app_serverRelease.kotlin_module'
        }


        defaultConfig {
            minSdkVersion parent.ext.androidMinSdkVersion
            targetSdkVersion parent.ext.androidTargetSdkVersion
            multiDexEnabled true
            versionCode 1
            versionName "1.0.0"
            vectorDrawables.useSupportLibrary = true
        }

        signingConfigs {

            debug {
                storeFile file("keystore.jks")
                storePassword "test"
                keyAlias "test"
                keyPassword "test"
            }
        }

        buildTypes {
            release {
                debuggable false
                minifyEnabled false
                shrinkResources false
                multiDexEnabled false
                if (project.hasProperty("RELEASE_STORE_FILE")) {
                    signingConfig signingConfigs.release
                } else {
                    signingConfig signingConfigs.debug
                }

                proguardFile getDefaultProGuardFile('proguard-release.pro')
                proguardFile getDefaultProGuardFile('proguard-androidx.pro')
                proguardFile 'proguard-project.pro'
            }

            debug {
                testCoverageEnabled false
                ext.enableCrashlytics = false
                signingConfig signingConfigs.debug
            }
        }

        flavorDimensions "default"
        productFlavors {
            production {
                dimension "default"
            }

            server {
                dimension "default"
                applicationIdSuffix ".server" + appIdSuffix
                resValue "string", appName, appIdSuffix
            }
        }

        dexOptions {
            javaMaxHeapSize "4g"
            preDexLibraries false
        }
    }

    dependencies {
        serverImplementation('com.github.tomakehurst:wiremock:2.8.0') {
            exclude group: 'com.fasterxml.jackson.core'
            exclude group: 'com.google.guava'
            exclude group: 'org.apache.httpcomponents'
            exclude group: 'org.ow2.asm', module: 'asm'
        }

        def nav_version = "1.0.0"

        implementation "android.arch.navigation:navigation-fragment:$nav_version"
        implementation "android.arch.navigation:navigation-ui:$nav_version"

        implementation "androidx.core:core-ktx:1.2.0"
        implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
        implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
        implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
        implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine"
        implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine"


        kaptAndroidTest 'org.parceler:parceler:1.1.12'
        testImplementation 'joda-time:joda-time:2.9.6'
        testImplementation 'junit:junit:4.12'
        testImplementation 'org.powermock:powermock-api-easymock:1.6.2'
        testImplementation 'org.powermock:powermock-core:1.6.2'
        testImplementation 'org.powermock:powermock-module-junit4:1.6.2'
        testImplementation 'org.powermock:powermock-api-mockito:1.6.2'
        testImplementation('org.robolectric:robolectric:4.2') {
            exclude group: 'com.google.guava'
        }
        testImplementation 'org.apache.commons:commons-lang3:3.6'

        testImplementation('org.mockito:mockito-all:1.10.19') {
            exclude group: 'org.hamcrest', module: 'hamcrest-core'
        }
        testImplementation 'org.mockito:mockito-all:1.10.19'
        testImplementation('com.squareup:fest-android:1.0.8') {
            exclude group: 'com.android.support', module: 'support-v4'
        }
        testImplementation 'androidx.test:core:1.2.0'
        testImplementation 'androidx.test.ext:junit:1.1.1'
        testImplementation 'org.apache.httpcomponents:httpclient:4.5.6'
        androidTestImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.capitalone.easyscreenshots:easyscreenshots:1.1.0@aar'
        androidTestImplementation 'com.jraska:falcon:2.1.1'
        androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0') {
            exclude module: 'support-annotations'
        }
        androidTestImplementation('androidx.test:runner:1.2.0') {
            exclude module: 'support-annotations'
        }
        androidTestImplementation('androidx.test:rules:1.2.0') {
            exclude module: 'support-annotations'
        }
        androidTestImplementation('androidx.test.espresso:espresso-intents:3.2.0') {
            exclude module: 'design'
            exclude module: 'support-annotations'
            exclude module: 'support-v4'
            exclude module: 'recyclerview-v7'
            exclude module: 'appcompat'
        }
        androidTestImplementation('androidx.test.espresso:espresso-contrib:3.2.0') {
            exclude module: 'design'
            exclude module: 'support-annotations'
            exclude module: 'support-v4'
            exclude module: 'recyclerview-v7'
            exclude module: 'appcompat'
        }
        androidTestImplementation('androidx.test.espresso:espresso-web:3.2.0') {
            exclude module: 'design'
            exclude module: 'support-annotations'
            exclude module: 'support-v4'
            exclude module: 'recyclerview-v7'
            exclude module: 'appcompat'
        }
    }

    apply plugin: 'com.google.gms.google-services'


...