生成的签名APK提供NullPointerException

时间:2017-09-28 13:43:35

标签: java android nullpointerexception google-play-console

所以我一直面对这个问题,我一直在寻找类似的问题,但我找不到一个。当我说我尝试了大多数我认为可能涉及的方法时,请相信我。问题是;当我生成一个已签名的APK以放置在Google Play商店时,它会生成正常的错误并且不显示任何错误。 当我下载应用程序并登录时,会出现此错误:

  

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

这很奇怪的原因是因为我的调试APK没有遇到同样的问题。

我在android studio中打开了logCat并连接了我的设备,看看它在错误过滤器中显示的是什么消息,我得到了这个:

09-28 14:42:25.016 15234-15351/? E/Volley: [9855] g.run: Unhandled exception java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
                                       java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
                                           at libcore.net.UriCodec.encode(UriCodec.java:132)
                                           at java.net.URLEncoder.encode(URLEncoder.java:57)
                                           at com.a.a.k.a(Unknown Source)
                                           at com.a.a.k.o(Unknown Source)
                                           at com.a.a.a.g.b(Unknown Source)
                                           at com.a.a.a.g.a(Unknown Source)
                                           at com.a.a.a.g.a(Unknown Source)
                                           at com.a.a.a.a.a(Unknown Source)
                                           at com.a.a.g.run(Unknown Source)
09-28 14:42:25.136 15234-15234/? E/MainActivity: Login Error: 
java.lang.NullPointerException: Attempt to invoke virtual method 'int 
java.lang.String.length()' on a null object reference
09-28 14:42:25.176 1425-1425/? E/KeyboardInfoUtils: getInstance start
09-28 14:42:25.176 1425-1425/? E/KeyboardInfoUtils: sendSIPInformation 
state:6  isAbstractKeyboardView : true
09-28 14:42:25.176 1425-1425/? E/KeyboardInfoUtils: sending null 
keyboardInfo as SIP is closed
09-28 14:42:25.286 164-164/? E/BufferQueueCore: [Toast] 
setDefaultMaxBufferCount: setting count to 3, previous is 2 

这也是我的build.gradle文件:

apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        keyAlias 'release-config'
        keyPassword '***********'
    }
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
    applicationId "co.uk.mednet.mednet_ghana"
    minSdkVersion 20
    targetSdkVersion 25
    versionName '1.0.1'
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    versionNameSuffix '1.0.5'
    versionCode 1016
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
productFlavors {
}
 }

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-core-utils:25.3.1'
compile 'org.androidannotations:androidannotations-api:4.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.barteksc:android-pdf-viewer:2.6.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.github.markushi:circlebutton:1.1'
testCompile 'junit:junit:4.12'
provided 'org.androidannotations:androidannotations:4.0.0'
}
android {
lintOptions {
    checkReleaseBuilds false
    abortOnError false
}
}

0 个答案:

没有答案