9

APP接入友盟统计,不上报数据问题

 3 years ago
source link: https://renyugang.blog.csdn.net/article/details/110811587
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

APP接入友盟统计,不上报数据问题

胖虎 2020-12-07 12:50:27 141

官方文档接入的流程大致如下:

主目录Build.gradle中buildscript 、allprojects都加入仓库地址:

maven { url 'https://dl.bintray.com/umsdk/release' }

app模块Build.gradle中加入:


// 下面各SDK根据宿主App是否使用相关业务按需引入。
 // OAID目前为目前国内市场主流的Android Q设备标识,可根据需要选择。
 // 友盟统计SDK BEGIN
 implementation  'com.umeng.umsdk:common:9.3.0' // (必选)版本号
 implementation  'com.umeng.umsdk:asms:1.1.3' // asms包依赖(必选)
 implementation 'com.umeng.umsdk:crash:0.0.5' // native crash包依赖(必选)
 implementation  'com.umeng.umsdk:oaid_lenovo:1.0.0' // (可选)
 implementation  'com.umeng.umsdk:oaid_mi:1.0.0' // (可选)
 implementation  'com.umeng.umsdk:oaid_oppo:1.0.4' // (可选)
 implementation  'com.umeng.umsdk:oaid_vivo:1.0.0.1' // (可选)
 // 友盟统计SDK END

主application类的onCreate中加入init代码:

// 初始化SDK
        UMConfigure.init(
            this,
            Your appkey,
            Your channel name,
            UMConfigure.DEVICE_TYPE_PHONE,
            ""
        )
        // 选用AUTO页面采集模式
        MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO)

一切看起来都很正常,UMLog中显示的也很正常,但是忽略的一点是它需要根据我们的应用签名来做判断,所以如果应用debug 或者 release版本没有进行应用签名,将会导致无法上报友盟统计数据。

因此,需要在build.gradle中android{ }加入对应的签名配置


    signingConfigs {
        debug {
            storeFile file('your debug.keystore')
            storePassword "xxxxxxx"
            keyAlias "xxxxxxxx"
            keyPassword "xxxxxxx"
        }
    }

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK