android扫雷完整代码,Android微信支付,填坑扫雷大全

在开发中,支付功能越来越普遍。相应的开发中遇到问题的人也越来越多。在此记录一下微信支付中出现的无法调起支付,调起后errrorCode一直返回-1,签名错误等问题的解决办法。

1.签名

最常见的错误。具体查看app签名请用官方提供的signApk,保持app签名、包名与平台配置的一致即可,就不再赘述了。在此想提一下的是对于使用AndroidStudio开发者来说, 可以在gradle中配置秘钥信息,这样就可以省去了每次打包再安装测试的时间。具体如下。

//该节点写在android节点下。

signingConfigs{

debug {

keyAlias '别名'

keyPassword '别名密码'

storePassword 'keyStore密码'

storeFile file('keyStore路径')

}

release{

keyAlias '别名'

keyPassword '别名密码'

storePassword 'keyStore密码'

storeFile file('keyStore路径')

}

}

2.清单文件配置

貌似微信的文档里边并没有注明这个。如果没有正确配置会导致无法调起支付。

android:name=".wxapi.WXEntryActivity"

android:configChanges="keyboardHidden|orientation|screenSize"

android:exported="true"

>

3、调用微信统一下单API、以及返回数据给前端时候的sign问题。

这个也是重点,因为微信的文档实在是很坑人。

调用统一下单时候的商户key,让人摸不着头脑的一个值。实际上这个是要登陆到商户平台去设置的,仔细看看文档也能找的到。具体步骤是 微信商户平台(pay.weixin.qq.com)-->账户设置-->API安全-->密钥设置

调用统一下单API后,按照微信文档中的业务流程,下一步该是:

统一下单接口返回正常的prepay_id,再按签名规范重新生成签名后,将数据传输给APP。

参与签名的字段名为appId,partnerId,prepayId,nonceStr,timeStamp,package。注意:package的值格式为Sign=WXPay

重点来了 个人认为这是文档中最大的坑。请注意上文中的key字段命名,没错,驼峰命名很规范。但是呢,实际上在做sign操作的时候,参与签名的这些key都

必须全是小写的 必须全是小写的 必须全是小写的

目前记起来的大概是这些,希望能帮到大家。

水平有限,若有错误请指正!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安卓 扫雷源码 添加重新开始按钮支持 Android studio ====================================== Risky Project Location: ----------------------- The tools *should* handle project locations in any directory. However, due to bugs, placing projects in directories containing spaces in the path, or characters like ", ' and &, have had issues. We're working to eliminate these bugs, but to save yourself headaches you may want to move your project to a location where this is not a problem. D:\Program Files\android_s_workplace\terrysaolei - Ignored Files: -------------- The following files were *not* copied into the new Gradle project; you should evaluate whether these are still needed in your project and if so manually move them: * ic_launcher-web.png * proguard-project.txt Moved Files: ------------ Android Gradle projects use a different directory structure than ADT Eclipse projects. Here's how the projects were restructured: * AndroidManifest.xml => app\src\main\AndroidManifest.xml * assets\ => app\src\main\assets * res\ => app\src\main\res\ * src\ => app\src\main\java\ Next Steps: ----------- You can now build the project. The Gradle project needs network connectivity to download dependencies. Bugs: ----- If for some reason your project does not build, and you determine that it is due to a bug or limitation of the Eclipse to Gradle importer, please file a bug at http://b.android.com with category Component-Tools. (This import summary is for your information only, and can be deleted after import once you are satisfied with the results.)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值