一路走来,已经总结了不少了。不过还差很远,进阶也还有好多知识呀!总归一直还是按着需要,按照补漏一点点进步的。 加油吧,小皮球!
这里由于新工程的需求,我干脆导入最新友盟吧,然后采用自动导入的方式。能简化模块的导入以及一些jar包的导入,视觉上看着简洁多了,呵呵。。。
之前的话采用的的是导入手动导入
1. 如果是推送的话,是直接添加push模块就行。对应缺的so,全平台so,有下载的地方:
![a5f1ab4975fb485ca9ea20eaab11439b.png](https://img-blog.csdnimg.cn/img_convert/a5f1ab4975fb485ca9ea20eaab11439b.png)
2. 如果是分享的话,开发者中心
![4a9173420d043c89c7a7a1fd4d58d6c9.png](https://img-blog.csdnimg.cn/img_convert/4a9173420d043c89c7a7a1fd4d58d6c9.png)
![9d877ab7d8d83add5d3a636359585af6.png](https://img-blog.csdnimg.cn/img_convert/9d877ab7d8d83add5d3a636359585af6.png)
2019年小萌新之前的版本推送是push_4.0.0, 然后相关社会化组件大概是1.5几的样子,然后jar包相对多些:
2018综合集成下来大概(包含推送和分享):
![5313fef8343ac3a1d31aa04cf906dfda.png](https://img-blog.csdnimg.cn/img_convert/5313fef8343ac3a1d31aa04cf906dfda.png)
![a63ecbe1fcbe5790cd310d10b761bdef.png](https://img-blog.csdnimg.cn/img_convert/a63ecbe1fcbe5790cd310d10b761bdef.png)
2018配置(buildSDK还是26,不是28哟!):
<!-- ########################友盟相关 start##################### -->
<!-- 微信 -->
<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- QQ -->
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tencent100424468" />
</intent-filter>
</activity>
<activity
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- 微博 -->
<!-- <activity -->
<!-- android:name="com.umeng.socialize.media.WBShareCallBackActivity" -->
<!-- android:configChanges="keyboardHidden|orientation" -->
<!-- android:exported="false" -->
<!-- android:launchMode="singleTask" -->
<!-- android:screenOrientation="portrait" -->
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity> -->
<!-- <activity -->
<!-- android:name="com.sina.weibo.sdk.web.WeiboSdkWebActivity" -->
<!-- android:configChanges="keyboardHidden|orientation" -->
<!-- android:exported="false" -->
<!-- android:windowSoftInputMode="adjustResize"></activity> -->
<!-- <activity -->
<!-- android:name="com.sina.weibo.sdk.share.WbShareTransActivity" -->
<!-- android:launchMode="singleTask" -->
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"> -->
<!-- <intent-filter> -->
<!-- <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- </activity> -->
<!-- in weibosdkcore_3.0.1.jar and before:xiong_it。微博SDK V3.1以后,剔除了这个Service,不用添加,否则报红色,并且无法消除 -->
<!--
<service android:name="com.sina.weibo.sdk.net.DownloadService"
android:exported="false">
</service>
-->
<!-- 分享编辑页 -->
<!-- <activity -->
<!-- android:name="com.umeng.socialize.editorpage.ShareActivity" -->
<!-- android:excludeFromRecents="true" -->
<!-- android:theme="@style/Theme.UMDefault" -->
<!-- /> -->
<!-- 多渠道打包使用 -->
<!-- 友盟统计APPKEY -->
<meta-data
android:name="UMENG_APPKEY"
android:value="xxxxxxxxxxxx" />
<!-- 设置一个默认的渠道名:service -->
<meta-data
android:name="UMENG_CHANNEL"
android:value="service" />
<!-- ########################友盟相关 end##################### -->
<service
android:name=".service.UPushIntentService"
android:enabled="true"
android:exported="true" />
<!-- ########################友盟推送服务 up##################### -->
UPushIntentService.java就参考官方就好了!
另外注意你的push模块的编译版本修改为和app一致:
![8dee104239b1da0bdc17de46a0fe118b.png](https://img-blog.csdnimg.cn/img_convert/8dee104239b1da0bdc17de46a0fe118b.png)
2019 (SDK6.9.0)最近准备开始新项目,把网络通用请求,通用适配器都干上了。然后准备开始继承友盟,分享等基础功能。过程中我本想直接把之前的push4.0.0模块以及相关jar拿过来,发现报奇怪的错误。最后干脆删除直接重新来,采用最新的sdk,同时采用自动集成(implementation)的方式。
不多说,照着官方文档来就行(而且官方也针对8.0做了说明,比如解决qq分享崩溃的问题,权限配置的问题) 。另外官方针对jar包做了精简,整合,比如
![37e94a17a2ff83dddb3dfd1b2ae0935f.png](https://img-blog.csdnimg.cn/img_convert/37e94a17a2ff83dddb3dfd1b2ae0935f.png)
![adce8ce6dd3d9e719e1e75b67c739f09.png](https://img-blog.csdnimg.cn/img_convert/adce8ce6dd3d9e719e1e75b67c739f09.png)
问题,qq8.0分享崩溃问题 - 友盟也说了(小萌新是自己看日志后修改了下,没注意友盟也提到了):
![a42844e1d59f12aa39668d81a019c7f6.png](https://img-blog.csdnimg.cn/img_convert/a42844e1d59f12aa39668d81a019c7f6.png)
其他细节照着教程基本ok了,相对还是问题不大!
2019继承方式,自动+部分手动:
![93a17f3e9d98cc6f23a6230a798eea11.png](https://img-blog.csdnimg.cn/img_convert/93a17f3e9d98cc6f23a6230a798eea11.png)
2019 配置加导入
///< 友盟
//PushSDK必须依赖基础组件库,所以需要加入对应依赖2.0.0 latest.integration不能下载成功
implementation 'com.umeng.umsdk:common:2.0.0'
//PushSDK必须依赖utdid库,所以需要加入对应依赖1.1.5.3
implementation 'com.umeng.sdk:utdid:1.1.5.3'
//Dplus8.0.0
implementation 'com.umeng.umsdk:analytics:8.0.0'
//PushSDK5.0.2
implementation 'com.umeng.umsdk:push:5.0.2'
//UmengShare
implementation files('libs/umeng-share-QQ-simplify-6.9.4.jar')
implementation files('libs/umeng-share-sina-simplify-6.9.4.jar')
implementation files('libs/umeng-share-wechat-simplify-6.9.4.jar')
implementation files('libs/umeng-share-core-6.9.4.jar')
implementation files('libs/umeng-sharetool-6.9.4.jar')
然后相关实现配置下即可:
![81ad60f30381c1fdcafceb1c207630ee.png](https://img-blog.csdnimg.cn/img_convert/81ad60f30381c1fdcafceb1c207630ee.png)
差不多就行了。测试了下,分享,推送都ok。差不多先这样简单记录下。