cordova cordova-plugin-wechat微信登陆常见问题

cordova cordova-plugin-wecha微信登陆常见问题

  • httpPost异常
  • 登陆不回调

最近做混合开发,项目要接入微信登陆,于是屁颠屁颠去使用cordova-plugin-wechat,一步步看着文档弄好了,支付分享什么的都没有问题,唯独登陆一直没响应,网上各种查找也没头绪,于是我就去logcat 看日志,日志报了下面的错误错误,

Failed resolution of: Lorg/apache/http/client/methods/HttpPost

然后各种网上找资料说高版本安卓缺少了org.apache.http.legacy,于是查资料在config.xml加上了org.apache.http.legacy配置

 <config-file parent="/manifest/application" target="AndroidManifest.xml">
        <uses-library android:name="org.apache.http.legacy" android:required="false" />
 </config-file>

加完之后错误没有了,但是依然没有回调,本人非安卓出身,各种查资料依然无法解决,于是网上找了一份安卓微信登陆的源码,从头到位看了一遍,发现多了一个activity配置于是在config.xml加上了这个配置,

 <config-file parent="/manifest/application" target="AndroidManifest.xml">
            <activity
                    android:name=".wxapi.WXEntryActivity"
                    android:label="WXEntryActivity"
                    android:exported="true" />
        </config-file>

httpPost异常

Failed resolution of: Lorg/apache/http/client/methods/HttpPost
在conffig.xml加上

 <config-file parent="/manifest/application" target="AndroidManifest.xml">
        <uses-library android:name="org.apache.http.legacy" android:required="false" />
 </config-file>

登陆不回调

在conffig.xml加上

 <config-file parent="/manifest/application" target="AndroidManifest.xml">
            <activity
                    android:name=".wxapi.WXEntryActivity"
                    android:label="WXEntryActivity"
                    android:exported="true" />
        </config-file>

参考资料 https://www.jianshu.com/p/04ed0b65f3df

你可能感兴趣的:(cordova)