xu-li / cordova-plugin-wechat

A cordova plugin, a JS version of Wechat SDK
1.22k stars 509 forks source link

Cannot build for Android #1

Closed wesson818 closed 9 years ago

wesson818 commented 10 years ago

Hi xu-li,

Great plugin! But when I try to build for Android, build Failed.

The step I installed it is:

  1. Install your plugin: cordova plugin add https://github.com/xu-li/cordova-plugin-wechat
  2. Add wechat lib(libammsdk.jar) to libs under project.
  3. cordova build android.

And then BUILD FAILED. I also add preference name="wechatappid" value="YOUR_WECHAT_APP_ID" to config.xml.

Do I missed some steps? Could you help me with this?

Many thanks!

Wesson

xu-li commented 10 years ago

Sorry, i haven't fully tested it on Android.

Could you please provide more details, like android version, phonegap version, and error message here? Maybe I can help you on that.

wesson818 commented 10 years ago

I am on Android SDK 4.2.2 and PhoneGap version 3.1.0. The error happened when I first build after I add the plugin. Error message point to Wechat.java file say: "Can not find the public class of Weixin". I think is something between Wechat.java and libammsdk.jar.

xu-li commented 10 years ago

That's because the class name of the Wechat.java is Weixin. You may fix that by renaming the class name from Weixin to Wechat.

wesson818 commented 10 years ago

I changed Weixin to Wechat. And then build successful, but the function is not working. It seems doesn't calling libammsdk.jar lib function.

icesyc commented 10 years ago

does the problem solved? I have the same problem on andriod build

xu-li commented 10 years ago

Not yet.

icesyc commented 10 years ago

would you plan to solve this?

xu-li commented 10 years ago

Sorry, I won't fix that until I need that in my project, or there are a lot of people want to use that.

wesson818 commented 10 years ago

@icesyc you need change "webView.getProperty(WXAPPID_PROPERTY_KEY, "");" to your appid from WeChat to make it work in Wechat.java.

icesyc commented 10 years ago

@wesson818 you are right. actually, the WXAPPID_PROPERTY_KEY is defined as "weixinappid" in Wechat.java, but in config.xml, there is "wechatappid", correct the const string to the same in config.xml is needed.

zero7u commented 10 years ago

@icesyc have u solved this problem? I changed WXAPPID_PROPERTY_KEY to wechatappid, same as config.xml, but it still not work, any ideas would be appriated, 3q!

zero7u commented 10 years ago

问题解决了,不是代码的问题,appid有问题,谢谢!

zero7u commented 10 years ago

安卓分享成功没有调用回调函数,请核查一下,谢谢!

xu-li commented 10 years ago

额,暂时没有android手机,而且去微信开放平台看了一下,好像我的帐号没有通过开发者认证,不能用了。。。

如果方便的话,能否共享一下你的帐号给我?

多谢。

icesyc commented 10 years ago

安卓的需要在wxentry里添加回调

发自我的 iPhone

在 2014年9月5日,9:16,"zero.qiu" notifications@github.com 写道:

安卓分享成功没有调用回调函数,请核查一下,谢谢!

— Reply to this email directly or view it on GitHub.

zilinxueyue commented 8 years ago

Hi,I following the same steps. auth success but share nothing happen. Would you please help to check any issue in my code. Wechat.isInstalled(function (installed) { WEIXININSTALL=installed; });

            /***************微信登录**************/

            Wechat.auth("snsapi_userinfo", function (response) {
                // you may use response.code to get the access token.
                alert(JSON.stringify(response));
            }, function (reason) {
                alert("Failed: " + reason);
            });

            Wechat.share({
                message: {
                    title: "分享",
                    description: "描述",
                    mediaTagName: "分享",
                    thumb: "分享的时候的图片链接",
                    media: {
                        type: Wechat.Type.WEBPAGE, //类型是一个webpage,就是一个网页?
                        webpageUrl: "www.baidu.com"
                    }
                },
                scene: Wechat.Scene.TIMELINE   // 分享到朋友圈

            }, function () {
                alert("分享成功");
            }, function (reason) {
                alert("分享失败"+reason);
        });

Thanks so much

xu-li commented 8 years ago

thumb 不是文字,是图片链接。webpageUrl改成http://www.baidu.com。

On Thu, May 19, 2016 at 3:28 PM, zilinxueyue notifications@github.com wrote:

Hi,I following the same steps. auth success but share nothing happen. Would you please help to check any issue in my code. Wechat.isInstalled(function (installed) { WEIXININSTALL=installed; });

        /***************微信登录**************/

        Wechat.auth("snsapi_userinfo", function (response) {
            // you may use response.code to get the access token.
            alert(JSON.stringify(response));
        }, function (reason) {
            alert("Failed: " + reason);
        });

        Wechat.share({
            message: {
                title: "分享",
                description: "描述",
                mediaTagName: "分享",
                thumb: "分享的时候的图片链接",
                media: {
                    type: Wechat.Type.WEBPAGE, //类型是一个webpage,就是一个网页?
                    webpageUrl: "www.baidu.com"
                }
            },
            scene: Wechat.Scene.TIMELINE   // 分享到朋友圈

        }, function () {
            alert("分享成功");
        }, function (reason) {
            alert("分享失败"+reason);
    });

Thanks so much

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/xu-li/cordova-plugin-wechat/issues/1#issuecomment-220247991

Thanks.

Xu Li, Shanghai, China

zilinxueyue commented 8 years ago

Hi, xu-li 我用了你的方法 打包release 版本后,第一次可以分享成功,但是第二次分享就没有响应了。我的退出微信登录,再次登录后,又可以分享一次,然后第二次又没有响应了。请问这个问题怎么解? Thanks‘

zilinxueyue commented 8 years ago

@xu-li 多谢你的分享,我试过了 现在可以用了。是2次分享要有时间间隔,过一会再分享就ok了。 Thanks