版本崩溃,但调试工作正常



我仅在发布版本中收到 null 的错误。但是当我创建发布版本时,它崩溃了,但在调试模式下工作正常。

当我优化我的apk时,我删除了mobile_navigation.xml文件,但它从未在任何地方使用

这是我的构建文件

//one signal integration
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
//end of one signal integration
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.codon.masterpiece"
minSdkVersion 17
targetSdkVersion 28
versionCode 110
versionName "4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [
onesignal_app_id               : 'a33a085c-d32d-4462-a850-334f5c73db01',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]

}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
release {
minifyEnabled true
//shrinkResources true
//proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layouts/home_and_fragments',
'src/main/res/layouts/login_and_onboarding',
'src/main/res/layouts',
'src/main/res'
]
}
}
buildToolsVersion '28.0.3'
compileOptions {
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.navigation:navigation-fragment:2.0.0'
implementation 'androidx.navigation:navigation-ui:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
//addedd libraries due to conflict
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
//card view
implementation 'androidx.cardview:cardview:1.0.0'
//Facebook sdk
implementation 'com.facebook.android:facebook-android-sdk:5.2.0'
//Google login
implementation 'com.google.android.gms:play-services-auth:17.0.0'
//Play Store core library
implementation 'com.google.android.play:core:1.6.1'
//Recyclerview
implementation 'androidx.recyclerview:recyclerview:1.0.0'
//Retrofit
//    implementation('com.squareup.retrofit2:retrofit:2.6.1') {
//        // exclude Retrofit’s OkHttp dependency module and define your own module import
//        exclude module: 'okhttp'
//    }
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
// exclude Retrofit’s OkHttp dependency module and define your own module import
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
//    implementation 'com.squareup.okhttp3:logging-interceptor:4.1.1'
//    implementation 'com.squareup.okhttp3:okhttp:4.1.1'
//Volley
implementation 'com.android.volley:volley:1.1.1'
//circle image view
implementation 'de.hdodenhof:circleimageview:2.2.0'
//image crop library
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
//Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//currency and country picker
//implementation 'com.github.midorikocak:currency-picker-android:1.1.9'
//implementation 'com.github.yesterselga:country-picker-android:1.0'
//country picker
implementation 'com.github.mukeshsolanki:country-picker-android:2.0.1'
//imageview zoom
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
//one signal
implementation 'com.onesignal:OneSignal:3.11.2'
//google analytics
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
//walkthrough
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
//progressbar
//implementation 'com.bigkoo:svprogresshud:1.0.6'

//facebook shimmer effect
implementation 'com.facebook.shimmer:shimmer:0.4.0'
//progress bar
implementation 'com.kaopiz:kprogresshud:1.2.0'

}

这是我的日志猫

Process: com.codon.masterpiece, PID: 13865
java.lang.NullPointerException: throw with null exception
at com.codon.masterpiece.d.b.b.a(Unknown Source:3)
at com.codon.masterpiece.ui.home.e$d.a(:341)
at f.g$b$a$a.run(:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

请告诉我发布模式下可能出现的问题

在 Gson 序列化过程中使用的模型的每个字段中添加序列化名称。

import com.google.gson.annotations.SerializedName;
public class Example {
@SerializedName("fieldName")//Add this line for all fields, the name passed in SerializedName should be a key in json
private String fieldName;
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
}

您可以将该模型保留在程序规则中

-keep class com.codon.masterpiece.model.Example { *; }//use the package name and class name for the models

最新更新