0

The app is works very well in debug mode. But in signed apk and after uploading in playstore, the app is closed automatically. I have tried:

  • Rebuild
  • Clean
  • Invalidate and restart
  • Added proguard of adgem

Here is the error in signed APK,

    E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mas.pns, PID: 3461
    java.lang.NullPointerException: throw with null exception
        at com.adgem.android.internal.g$a.onResponse(SourceFile:2)
        at com.adgem.android.internal.g$c.onResponse(SourceFile)
        at gb.k$b$a$a.run(SourceFile:3)
        at android.os.Handler.handleCallback(Handler.java:754)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:163)
        at android.app.ActivityThread.main(ActivityThread.java:6393)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
2022-05-12 12:39:09.936 3562-3739/? E/##XLogger##: com.miui.cloudservice.cloudcontrol.@IPV6@SourceFile:2, thread:5040--cloud config is not expired , request canceled
2022-05-12 12:39:10.871 1600-1875/? E/FE_LOG: ObservableUtils: accept: 
    java.lang.NullPointerException: The mapper function returned a null value.
        at h.a.d.b.b.a(ObjectHelper.java:1)
        at h.a.d.e.a.c$a.onNext(ObservableMap.java:4)
        at h.a.d.e.a.e.run(ObservableScalarXMap.java:2)
        at h.a.d.e.a.b.b(ObservableJust.java:3)
        at h.a.d.a(Observable.java:20)
        at h.a.d.e.a.c.b(ObservableMap.java:1)
        at h.a.d.a(Observable.java:20)
        at h.a.d.e.a.f$b.run(ObservableSubscribeOn.java:1)
        at h.a.d.g.j.call(ScheduledDirectTask.java:3)
        at h.a.d.g.j.call(ScheduledDirectTask.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Is it anything with my gradle files I don't know exact details so Here is my build. gradle:

android {
    compileSdkVersion 31
    buildToolsVersion "30.0.3"


    buildFeatures {
        viewBinding true
    }


    defaultConfig {
        applicationId "com.mas.pns"
        minSdkVersion 21
        //noinspection OldTargetApi
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }



    configurations {

        all {

            exclude group : 'commons-logging', module: 'commons-logging'
            exclude group : 'org.apache.httpcomponents', module : 'httpclient'

        }

    }






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





    compileOptions {

        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11

    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.6.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'


    implementation 'androidx.multidex:multidex:2.0.1'




    //firebase
    implementation platform('com.google.firebase:firebase-bom:28.0.1')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-firestore'
    implementation 'com.google.firebase:firebase-storage:20.0.1'
    implementation 'com.google.firebase:firebase-database'
    implementation 'com.google.firebase:firebase-messaging:23.0.3'
    implementation 'com.google.android.gms:play-services-auth:20.2.0'



    // Sweet alert box
    implementation 'com.github.f0ris.sweetalert:library:1.6.2'

    // circle imageview
    implementation 'de.hdodenhof:circleimageview:3.1.0'

    implementation 'com.github.bumptech.glide:glide:4.12.0'

    // Smooth bottomBar
    implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.7.6'

    // adGem
    implementation 'com.adgem:adgem-android:3.0.1'

    implementation 'com.karumi:dexter:6.2.2'

    // swipe decorate
    implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3'

    // unity
    implementation files('libs/unity-ads.aar')

    //poll_fish
    implementation 'com.pollfish:pollfish-googleplay:6.1.4'

    // AyEt Studio
    implementation files('libs/ayetpublisher3.6.jar')

    //admob
    implementation 'com.google.android.gms:play-services-ads:20.6.0'
}
Angel
  • 115
  • 1
  • 6
  • look into this https://stackoverflow.com/questions/56142150/fatal-exception-java-lang-nullpointerexception-in-release-build – Talha Mahmood May 12 '22 at 07:32
  • That doesn't really helped me @TalhaMahmood – Angel May 12 '22 at 08:05
  • One of your mapper function returning a null value which you need to identify. for reference you can look into this link https://stackoverflow.com/questions/47652603/the-mapper-function-returned-a-null-value – Talha Mahmood May 12 '22 at 08:18
  • @TalhaMahmood How do i check it ? – Angel May 12 '22 at 08:20
  • you can try setting minifyEnabled = true in debug in build.gradle file and check where it is crashing – Talha Mahmood May 12 '22 at 08:22
  • Already true @TalhaMahmood – Angel May 12 '22 at 08:49
  • is it crashing in debug ? build.gradle must be like this buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } – Talha Mahmood May 12 '22 at 08:50
  • @TalhaMahmood It is not crashing in debug mode, works perfectly fine here is my buildtypes release { minifyEnabled true debuggable false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } – Angel May 12 '22 at 08:54
  • you need to add debug there. debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } then it will crash in debug to – Talha Mahmood May 12 '22 at 09:06
  • @TalhaMahmood I have added debug mode true, but it works fine in debug mode – Angel May 12 '22 at 10:04
  • can you upload your build.gradle file here – Talha Mahmood May 12 '22 at 10:21
  • I have added gradle to the post, @TalhaMahmood – Angel May 12 '22 at 10:29

0 Answers0