0

У меня есть приложение календаря с заметками. Сначала для его тестирования на реальном устройстве, я всегда генерировал debug-версию apk. А потом я решил протестировать приложение на устройствах друзей, и для этого я сгенерировал release-версию моего apk c цифровой подписью. Всё было нормально, но после некоторых изменений в манифесте apk перестал устанавливаться (при установке выдаёт "Приложение не установлено. Возможно, пакет повреждён") В logcat была вот такая ошибка: java.lang.NullPointerException: The mapper function returned a null value. В чём у меня проблема, и как её устранить? Подойдут любые варианты. Заранее спасибо.

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.masterok.calendar">

    <uses-permission android:name="android.permission.INTERNET" />

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="false"
        android:xlargeScreens="true" />

    <application

        android:label="@string/app_name"
        android:icon="@drawable/ikon_for_calendar_1"
        android:supportsRtl="false"
        android:theme="@style/Theme.Calendar"
        android:allowBackup="false">

        <activity
            android:name=".MainActivity"
            android:exported="true"

            android:screenOrientation="sensorPortrait"
            tools:ignore="ExtraText"/>
        <activity
            android:name=".EditActivity"
            android:exported="false"

            android:screenOrientation="sensorPortrait"
            android:theme="@style/Theme.EditTheme" />
        <activity
            android:name=".Notes"
            android:exported="true"

            android:screenOrientation="sensorPortrait">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-5488979700425931~2033858825" />
    </application>

</manifest>

build.gradle(:app):

plugins {
    id 'com.android.application'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.masterok.calendar"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"
        multiDexEnabled=true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        vectorDrawables.useSupportLibrary=true
        minSdkVersion 21
        signingConfig signingConfigs.debug
        targetSdkVersion 31
    }


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

        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'com.google.android.gms:play-services-ads:20.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'

    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

build.gradle(Calendar):

buildscript {
    repositories {

        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'

        
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 ответ 1

0

Когда я чуть-чуть повозился с этой проблемой, то понял, в чём проблема: в файле build.gradle(:app), а именно в конфигурации подписи apk файла. По умолчанию она была debug, а само приложение было release. Проблема решилась при изменении конфигурации подписи на release, а именно, добавлением в build.gradle(:app)следующих строчек:

signingConfigs {
        release {

        }
    }

Я думаю, этот ответ поможет тем, у кого такая же проблема.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.