Android signs configs and conflicts with abi splits

I have a project that uses a library jni. for this I have these settings in my file gradlein order to split apks based on their platform (and it works fine):

applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.properties.put(signingConfig, signingConfigs.config)
            output.versionCodeOverride =
                    versionCodes.get(output.getFilter(
                            com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
        }
    }

splits {
        abi {
            enable true
            reset()
            include "armeabi", "armeabi-v7a", "arm64-v8a", "mips", "mips64", "x86", "x86_64"

            universalApk true
        }
    }

Now I want to set the signature configuration so that I can run the releaseBuild option directly from android studio, so I added this to my file gradle:

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    signingConfigs {
            config {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile rootProject.file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }

    buildTypes {
            release {
                minifyEnabled true
                shrinkResources true
                buildConfigField "boolean", "MOCK_MODE", "false"
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                signingConfig signingConfigs.config
            }
            debug {
                minifyEnabled false
                shrinkResources false
                buildConfigField "boolean", "MOCK_MODE", "true"
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
}

After that, if I started the release build, I will get an error Error:path may not be null or empty string. path='null'

Please note that if I turn off the separation by setting abi {enable false}, the signature will be posted and the application will run as expected, so I think there is some Complication between splitting apks and signing the configuration.

.

tnx .

+4

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


All Articles