Android友盟分享整合微信QQ微博分享demo精簡版
阿新 • • 發佈:2019-01-24
c.將debug.keystore檔案加入到build.gradle同級,目的是為了使用友盟的簽名,完成後
build.gradle應該是這樣
- apply plugin: 'com.android.application'
- android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
- defaultConfig {
- applicationId "com.umeng.soexample"
-
minSdkVersion 19
- targetSdkVersion 22
- }
- buildTypes {
- release {
- // 是否進行混淆
- minifyEnabled true
- // 混淆檔案的位置
- // signingConfig signingConfigs.debug
- proguardFiles 'proguard-rules.pro'
- }
- debug {
-
minifyEnabled true
- //signingConfig signingConfigs.debug
- proguardFiles 'proguard-rules.pro'
- }
- }
- /*加上這段程式碼是為了直接執行可以用正式的簽名,所以在自己的專案中如果是直接用正式簽名可以刪除
- 不用真是簽名微博與微信是無法正常執行的,這個demo是友盟分享demo的簡化版,只有微信,qq,微博
- 三個平臺,在專案中一定要確定自己的專案包名簽名與各個平臺申請的app是相對應的*/
-
signingConfigs {
- debug {
- storeFile file('debug.keystore')
- storePassword "android"
- keyAlias "androiddebugkey"
- keyPassword "android"
- }
- }
- lintOptions {
- abortOnError false
- }
- packagingOptions {
- exclude 'META-INF/LICENSE.txt'
- }
- }
- dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:23.2.1'
- testCompile 'junit:junit:4.12'
- compile files('libs/SocialSDK_QQZone_3.jar')
- compile files('libs/SocialSDK_umengqq.jar')
- compile files('libs/SocialSDK_umengsina.jar')
- compile files('libs/SocialSDK_umengwx.jar')
- compile files('libs/SocialSDK_WeiXin_2.jar')
- compile files('libs/umeng_social_api.jar')
- compile files('libs/umeng_social_net.jar')
- compile files('libs/umeng_social_view.jar')
- }
e.在mainfest中新增activity
- <spanstyle="font-size:12px;"><?xmlversion="1.0"encoding="utf-8"?>
- <manifestxmlns:android="http://schemas.android.com/apk/res/android"
- package="com.umeng.soexample">
- <uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE"/>
- <uses-permissionandroid:name="android.permission.READ_PHONE_STATE"/>
- <uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <uses-permissionandroid:name="android.permission.READ_EXTERNAL_STORAGE"/>
- <uses-permissionandroid:name="android.permission.INTERNET"/>
- <uses-permissionandroid:name="android.permission.READ_LOGS"/>
- <uses-permissionandroid:name="android.permission.CALL_PHONE"/>
- <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>
- <uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>
- <!-- renren sso Permission for Unit Test -->
- <!-- QQ、QQ空間所需許可權 -->
- <uses-permissionandroid:name="android.permission.GET_TASKS"/>
- <uses-permissionandroid:name="android.permission.SET_DEBUG_APP"/>
- <uses-permissionandroid:name="android.permission.SYSTEM_ALERT_WINDOW"/>
- <uses-permissionandroid:name="android.permission.GET_ACCOUNTS"/>
- <uses-permissionandroid:name="android.permission.USE_CREDENTIALS"/>
- <uses-permissionandroid:name="android.permission.MANAGE_ACCOUNTS"/>
- <application
- android:name="com.umeng.soexample.App"
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:supportsRtl="true"
- android:theme="@style/AppTheme">
- <activityandroid:name=".MainActivity">