【SQ10016】QQ分享模块在线依赖编译报错
QQ分享模块在线依赖编译报错
问题关键字:
placeholder qqappid ‘com.umeng.umsdk:share-qq:6.9.4’ ‘also present’
问题描述:
通过maven在线依赖方式导入QQ分享模块后编译报错:
添加QQ分享模块到工程build.gradle脚本文件中后。
compile 'com.umeng.umsdk:share-qq:6.9.4'
//编译出现如下报错:
:app:processDebugManifest
/Users/umeng/umeng_work/MulFuncDemo/app/src/main/AndroidManifest.xml:154:13-74 Error:
Attribute activity#com.tencent.connect.common.AssistActivity@configChanges value=(orientation|keyboardHidden|screenSize) from AndroidManifest.xml:154:13-74
is also present at [com.umeng.umsdk:share-qq:6.9.4] AndroidManifest.xml:27:13-63 value=(orientation|keyboardHidden).
Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml:150:9-154:76 to override.
/Users/umeng/umeng_work/MulFuncDemo/app/src/main/AndroidManifest.xml:152:13-49 Error:
Attribute activity#com.tencent.connect.common.AssistActivity@screenOrientation value=(portrait) from AndroidManifest.xml:152:13-49
is also present at [com.umeng.umsdk:share-qq:6.9.4] AndroidManifest.xml:28:13-47 value=(behind).
Suggestion: add 'tools:replace="android:screenOrientation"' to <activity> element at AndroidManifest.xml:150:9-154:76 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.解决方案:
因为QQ分享模块对应aar文件中已经包含了QQ分享对应的相关Activity配置内容,所以为防止AndroidManifest.xml清单合并内容发生冲突,需要删除宿主App配置清单中和QQ分享有关的内容。
在线QQ分享模块中包含的QQ分享配置如下,需要删除宿主App清单配置中”com.tencent.tauth.AuthActivity”和”com.tencent.connect.common.AssistActivity”相关配置。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.umeng.socialize.qqzone"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="22" />
<application>
<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="tencent${qqappid}" />
</intent-filter>
</activity>
<activity
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="behind"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
</application>
</manifest>注意:在线QQ分享模块配置清单中 qqappid 使用manifestPlaceholders占位,如果未提供 qqappid,编译时会报如下错误:
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest
/Users/umeng/umeng_work/MulFuncDemo/app/src/main/AndroidManifest.xml Error:
Attribute data@scheme at AndroidManifest.xml requires a placeholder substitution but no value for <qqappid> is provided.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute data@scheme at AndroidManifest.xml requires a placeholder substitution but no value for <qqappid> is provided.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.需要在您的宿主工程build.gradle -> android -> defaultConfig 字段中加入:
manifestPlaceholders = [qqappid: "100424468"]
注意:此处的qqappid需要输入贵司App自己在QQ后台申请的appid。