xyzlf / sharesdk Goto Github PK
View Code? Open in Web Editor NEW分享SDK,包括微信、朋友圈,微博,QQ,QQ空间等渠道分享。
License: MIT License
分享SDK,包括微信、朋友圈,微博,QQ,QQ空间等渠道分享。
License: MIT License
ShareByWeixin里面的广播没有被调用?
我看到新版本里对于微博分享已经不需要任何配置了,但点击微博分享时有“暂不支持该格式分享到微博”的提示
这是什么问题呢
Android 8.0
肯定用的正式的, 但程序在横屏状态下
在Activity 和 fragment 页面下都能调起分享对话框, 在 activity 下选择分享微信, 返回statue = 4 ,没死机但无法打开微信, 在fragment 下面 没有回调 直接死机了
打开分享到对话框后 跟踪到的代码:
I/CrashReport: Set native info: isAppForeground(false)
D/ViewRootImpl@77dc516[MentalMainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
D/CrashReport: >>> com.xyzlf.share.library.ShareDialogActivity onCreated <<<
W/Bundle: Key extra_share_data expected Bundle but value was a com.xyzlf.share.library.bean.ShareEntity. The default value was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: com.xyzlf.share.library.bean.ShareEntity cannot be cast to android.os.Bundle
at android.os.Bundle.getBundle(Bundle.java:871)
at android.content.Intent.getBundleExtra(Intent.java:7972)
at com.xyzlf.share.library.ShareDialogActivity.onCreate(ShareDialogActivity.java:45)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
W/System.err: android.content.pm.PackageManager$NameNotFoundException: com.tencent.mobileqq
at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:298)
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:269)
at com.xyzlf.share.library.util.ChannelUtil.isAppInstall(ChannelUtil.java:26)
at com.xyzlf.share.library.util.ChannelUtil.isQQInstall(ChannelUtil.java:48)
at com.xyzlf.share.library.ShareDialogActivity.initChannelData(ShareDialogActivity.java:99)
W/System.err: at com.xyzlf.share.library.ShareDialogActivity.onCreate(ShareDialogActivity.java:79)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
D/CrashReport: >>> com.xyzlf.share.library.ShareDialogActivity onResumed <<<
I/CrashReport: Set native info: isAppForeground(true)
D/ViewRootImpl@7b87460[ShareDialogActivity]: setView = DecorView@f3efd19[ShareDialogActivity] TM=true MM=false
V/InputMethodManager: Not IME target window, ignoring
D/ViewRootImpl@7b87460[ShareDialogActivity]: dispatchAttachedToWindow
V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
D/ViewRootImpl@7b87460[ShareDialogActivity]: Relayout returned: old=[0,0][0,0] new=[720,313][1840,1126] result=0x7 surface={valid=true 3290238976} changed=true
D/OpenGLRenderer: eglCreateWindowSurface = 0xc254dd88
D/AbsListView: in onLayout changed
如题
只分享图片可以吗?
希望可以自定义分享渠道,或者有自定义的文档。
你好,请问你做这个分享大图的功能具体使用到sharesdk的是什么api?我直接集成sharesdk分享本地图片总 感觉被压缩了
在为自己的APP增加分享功能时,使用了您的shareSDK,但是在微信分享时一直显示 由于不支持的分享类型,无法分享到微信,不知道是有什么坑被我忽略了,希望您在百忙之中能抽出点时间 帮助我一下。
以下是我的分享文本的代码:
ShareEntity shareBean = new ShareEntity("title", "content.");
shareBean.setUrl("http://www.xxxx.com");
int channel = ShareConstant.SHARE_CHANNEL_WEIXIN_FRIEND | ShareConstant.SHARE_CHANNEL_WEIXIN_CIRCLE | ShareConstant.SHARE_CHANNEL_QQ;
ShareUtil.showShareDialog(getActivity(), channel, shareBean, ShareConstant.REQUEST_CODE);
当我点击微信分享时,出现错误,错误日志如下:
W/Bundle: Key extra_share_data expected Bundle but value was a com.xyzlf.share.library.bean.ShareEntity. The default value was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: com.xyzlf.share.library.bean.ShareEntity cannot be cast to android.os.Bundle
at android.os.Bundle.getBundle(Bundle.java:739)
at android.content.Intent.getBundleExtra(Intent.java:5554)
at com.xyzlf.share.library.ShareDialogActivity.onCreate(ShareDialogActivity.java:44)
请问这个是什么原因呢?QQ分享是正常的。
/**
*
* @param is 第二次压缩容易为空
* @param width
* @param height
* @return
*/
private Bitmap getSampleBitmap(InputStream is, int width, int height)
{
BufferedInputStream stream = new BufferedInputStream(is);
stream.mark(4 * 1024);
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(stream, null, options);
calculateInSampleSize(width, height, options, true);
try
{
stream.reset();
} catch (IOException e)
{
}
return BitmapFactory.decodeStream(stream, null, options);
}
建议修改一下:
private Bitmap getSampleBitmap2(byte[] data, int width, int height)
{
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(data, 0, data.length, options);
calculateInSampleSize(width, height, options, true);
return BitmapFactory.decodeByteArray(data, 0, data.length, options);
}
2017-07-03 16:43:15
App Version:1.0_1
OS version:6.0_23
Vendor:ZTE
Model:ZTE BV0720
CPU ABI:arm64-v8a
java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxx/com.xyzlf.share.library.ShareHandlerActivity}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.sina.weibo.remotessoservice }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2551)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2617)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5701)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.sina.weibo.remotessoservice }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1281)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1380)
at android.app.ContextImpl.bindService(ContextImpl.java:1358)
at android.content.ContextWrapper.bindService(ContextWrapper.java:604)
at com.sina.weibo.sdk.auth.sso.SsoHandler.bindRemoteSSOService(SsoHandler.java:329)
at com.sina.weibo.sdk.auth.sso.SsoHandler.authorize(SsoHandler.java:182)
at com.sina.weibo.sdk.auth.sso.SsoHandler.authorize(SsoHandler.java:133)
at com.xyzlf.share.library.channel.ShareByWeibo.share(ShareByWeibo.java:94)
at com.xyzlf.share.library.ShareHandlerActivity.onCreate(ShareHandlerActivity.java:77)
at android.app.Activity.performCreate(Activity.java:6270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2504)
... 9 more
您好:关于shareLIbrary中的jar包有一些问题一直想不通
libs目录下目前有2个jar包:libammsdk-2.0.jar是微信分享的jar包,open_sdk_r5756_lite是QQ分享的jar包,但是项目中集成了sina_weibo的分享,我按照官方文档没有找到具体的jar包或者依赖,请问一下具体是怎么做到的呢
ShareByWeixin.shareImg
while (width * height > THUMB_SIZE * THUMB_SIZE) {
width /= 2;
height /= 2;
}
bitmap的大小和尺寸的大小貌似没有必然关系。
ShareByWeixin类里面的 buildWXMediaMessage方法, if (TextUtils.isEmpty(data.getUrl()))判断是否少了bitmap==null~ 如果分享图片的时候 ShareEntity填了imageUrl 并没有填Url的时候~ 会直接分享文本~ 而不是图片~
如题~ 测试发现有些内容无法分享出去 无法调起微信界面~ 查看日志微信打印log~ checkArgs fail, description is invalid~ 查看微信代码在WXMediaMessage发现如下代码~
final boolean checkArgs() {
if(this.getType() != 8 || this.thumbData != null && this.thumbData.length != 0) {
if(this.getType() == 36 && (this.thumbData == null || this.thumbData.length > 131072)) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, thumbData should not be null or exceed 128kb");
return false;
} else if(this.getType() != 36 && this.thumbData != null && this.thumbData.length > '耀') {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, thumbData is invalid");
return false;
} else if(this.title != null && this.title.length() > 512) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, title is invalid");
return false;
} else if(this.description != null && this.description.length() > 1024) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, description is invalid");
return false;
} else if(this.mediaObject == null) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, mediaObject is null");
return false;
} else if(this.mediaTagName != null && this.mediaTagName.length() > 64) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, mediaTagName is too long");
return false;
} else if(this.messageAction != null && this.messageAction.length() > 2048) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, messageAction is too long");
return false;
} else if(this.messageExt != null && this.messageExt.length() > 2048) {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, messageExt is too long");
return false;
} else {
return this.mediaObject.checkArgs();
}
} else {
Log.e("MicroMsg.SDK.WXMediaMessage", "checkArgs fail, thumbData should not be null when send emoji");
return false;
}
}
我把你的moudle导入我的项目,结果报这个 错。。。。。
程序签名了,也在微信平台注册,且审核通过,但分享的时候上面的文字提示 由于不支持的分享类型,无法分享, 但下面的按钮是”返回(未审核的应用)“ , 只需要填写appkey, 不需要开放平台的微信appid吗?
另外,我修改过开放平台的app 的签名数据, 但提示是审核通过状态啊
谢谢
老铁,分享微信、QQ、微博,都是需要他们的key或者APPID, 这个在自己的项目中要怎么配置,才能给到你呢
大佬,你的weibo.sdk:core版本是多少,我这边在自己的项目中需要实现新浪微博第三方登录,可是没有办法引用到SsoHandler和Oauth2AccessToken这两个类
在build时报如上错误。
刚开始学安卓,请大佬指教
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK com/tencent/mm/sdk/platformtools/rep5402863540997075488.tmp
File1: C:\Users\Administrator.android\build-cache\3ea4306d89f3d4f6c520363c0fe7c88eb50a3d63\output\jars\classes.jar
File2: C:\Users\Administrator.android\build-cache\f86656d601928fb4f5ef98a54bbef1fdefa114a5\output\jars\classes.jar
微信无法分享
请协助修复,谢谢
腾讯全家桶分享一键调用,支持QQ、微信、小程序https://github.com/michael007js/share
点击微博分享,进入微博分享的界面,然后点击取消,走的是微博分享成功的回调。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.