实现三星指纹API时真的很奇怪:“期望取消装入'int'基本类型但返回null”

时间:2015-12-28 01:28:29

标签: android nullpointerexception int fingerprint

我的应用允许用户使用他们的指纹访问他们的照片。这是创建默认对话框的基本方法:

SpassFingerprint.IdentifyListener identifyListener = new SpassFingerprint.IdentifyListener() {
 @Override
 public void onFinished(int i) {
     if (i == SpassFingerprint.STATUS_AUTHENTIFICATION_SUCCESS || i == SpassFingerprint.STATUS_AUTHENTIFICATION_PASSWORD_SUCCESS) {
    MainActivity.myFolder.edit().putBoolean("samsung", (boolean) newValue).apply();
    Toast.makeText(getActivity().getApplicationContext(), "Fingerprint confirmed.", Toast.LENGTH_LONG).show();
} else MainActivity.myFolder.edit().putBoolean("samsung", false).apply();
}

@Override
public void onReady() {

}

@Override
public void onStarted() {

}
};    
mSpassFingerprint.startIdentifyWithDialog(getActivity().getApplicationContext(), identifyListener, true);

在我测试时,这在我的手机上没有错误,但在生产模式下,它会抛出一个NullPointerException,表示“预期取消装入'int'原始类型但返回null”。我从未见过像这样的错误。它必须与三星的用户身份验证方法或创建对话框有关。使用三星的指纹认证时有没有人见过这样的东西?

1 个答案:

答案 0 :(得分:2)

如果有人仍在寻找这个问题的答案,那么会因为proguard-rules开启了混淆而发生。修复方法是将这些行添加到-dontwarn com.samsung.** -keep class com.samsung.** {*;} 文件中:

import scrapy

from pogba.items import PogbaItem

class DmozSpider(scrapy.Spider):
    name = "pogba"
    allowed_domains = ["fourfourtwo.com"]
    start_urls = [
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459525/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459571/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459585/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459614/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459635/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459644/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459662/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459674/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459686/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459694/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459705/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459710/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459737/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459744/player-stats/74208/OVERALL_02",
        "http://www.fourfourtwo.com/statszone/21-2012/matches/459765/player-stats/74208/OVERALL_02"
    ]

    def parse(self, response):
        Coords = []
        for sel in response.xpath('//*[@id="pitch"]/*[contains(@class,"success")]'):
            item = PogbaItem()
            item['x'] = sel.xpath('(@x|@x1)').extract() 
            item['y'] = sel.xpath('(@y|@y1)').extract() 
            Coords.append(item)
        return Coords