美文网首页Android问题汇总(遥远的回忆过去)
Android-友盟集成-implementation方式(部分

Android-友盟集成-implementation方式(部分

作者: MonkeyLei | 来源:发表于2019-08-14 09:44 被阅读12次

一路走来,已经总结了不少了。不过还差很远,进阶也还有好多知识呀!总归一直还是按着需要,按照补漏一点点进步的。 加油吧,小皮球!

这里由于新工程的需求,我干脆导入最新友盟吧,然后采用自动导入的方式。能简化模块的导入以及一些jar包的导入,视觉上看着简洁多了,呵呵。。。

之前的话采用的的是导入手动导入

1. 如果是推送的话,是直接添加push模块就行。对应缺的so,全平台so,有下载的地方:

image

2. 如果是分享的话,开发者中心

image image

2019年小萌新之前的版本推送是push_4.0.0, 然后相关社会化组件大概是1.5几的样子,然后jar包相对多些:

2018综合集成下来大概(包含推送和分享):

image image

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一致:

image

2019 (SDK6.9.0)最近准备开始新项目,把网络通用请求,通用适配器都干上了。然后准备开始继承友盟,分享等基础功能。过程中我本想直接把之前的push4.0.0模块以及相关jar拿过来,发现报奇怪的错误。最后干脆删除直接重新来,采用最新的sdk,同时采用自动集成(implementation)的方式。

不多说,照着官方文档来就行(而且官方也针对8.0做了说明,比如解决qq分享崩溃的问题,权限配置的问题) 。另外官方针对jar包做了精简,整合,比如

image image

问题,qq8.0分享崩溃问题 - 友盟也说了(小萌新是自己看日志后修改了下,没注意友盟也提到了):

image

其他细节照着教程基本ok了,相对还是问题不大!

2019继承方式,自动+部分手动:

image

<figcaption style="margin-top: 0.66667em; padding: 0px 1em; font-size: 0.9em; line-height: 1.5; text-align: center; color: rgb(153, 153, 153);">jar包,精简了很多</figcaption>

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')

然后相关实现配置下即可:

image

差不多就行了。测试了下,分享,推送都ok。差不多先这样简单记录下。

相关文章

网友评论

    本文标题:Android-友盟集成-implementation方式(部分

    本文链接:https://www.haomeiwen.com/subject/rhvwjctx.html