最近应用市场审核要求APP在首次打开弹出用户协议或隐私政策,在用户同意政策之前不能对相关SDK进行初始化。以防应用提前收集用户信息,保护用户信息安全。为满足最新应用市场审核需求,项目中集成过老的友盟SDK需要重新集成最新版本。
工具:AndroidStudio 版本:4.0.1+
步骤1:
在app文件下的build.gradle的defalutConfig闭包中做如下配置:
defaultConfig { applicationId "com.smg.xxx"//包名 minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" manifestPlaceholders = [qqappid: "tencent11056021xx"]//QQ申请的appid //解决新增第三方okhttp中引入的Java8特性 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }
在依赖的闭包配置文件中引入远程依赖如下:
dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'androidx.appcompat:appcompat:1.2.0' testImplementation 'junit:junit:4.12' implementation "com.android.support:appcompat-v7:28.0.0" implementation "com.android.support:support-v4:28.0.0" implementation "com.android.support:design:28.0.0" implementation 'com.umeng.umsdk:common:9.4.4'//必选 implementation 'com.umeng.umsdk:asms:1.4.1'//必选 implementation 'com.umeng.umsdk:link:1.2.0'//集成U-Link,可选,如要统计分享回流次数和分享新增用户指标则必选 implementation 'com.umeng.umsdk:share-core:7.1.7'//分享核心库,必选 implementation 'com.umeng.umsdk:share-board:7.1.7'//分享面板功能,可选 implementation 'com.umeng.umsdk:share-wx:7.1.7'//微信完整版 implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.8.0'//微信官方依赖库,必选 implementation 'com.umeng.umsdk:share-qq:7.1.7'//QQ完整版 implementation files('libs/open_sdk_3