diff --git a/README.md b/README.md index bf6770b..5129e35 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Pub Package](https://img.shields.io/pub/v/tencent_kit.svg)](https://pub.dev/packages/tencent_kit) [![License](https://img.shields.io/github/license/RxReader/tencent_kit)](https://github.com/RxReader/tencent_kit/blob/master/LICENSE) -flutter版腾讯(QQ)SDK +Flutter 版腾讯(QQ)SDK ## 相关工具 @@ -29,19 +29,9 @@ flutter版腾讯(QQ)SDK ### Android -* 接入 - -```groovy -android { - defaultConfig{ - manifestPlaceholders += [ - TENCENT_APP_ID: "your tencent appId" - ] - } -} -``` - ``` +# 不需要做任何额外接入工作 +# 配置已集成到脚本里 # 混淆已打入 Library,随 Library 引用,自动添加到 apk 打包混淆 ``` diff --git a/android/build.gradle b/android/build.gradle index ac2914d..506c001 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,6 +16,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'org.yaml:snakeyaml:1.17' } } @@ -45,6 +46,12 @@ android { // library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆 consumerProguardFiles 'consumer-rules.pro' + + File root_project_dir = rootProject.projectDir.parentFile + def cfg = new org.yaml.snakeyaml.Yaml().load(new File(root_project_dir, 'pubspec.yaml').text) + manifestPlaceholders += [ + TENCENT_APP_ID: cfg.tencent_kit?.app_id + ] } flavorDimensions 'vendor' diff --git a/android/tencent-setup.gradle b/android/tencent-setup.gradle deleted file mode 100644 index 60906b5..0000000 --- a/android/tencent-setup.gradle +++ /dev/null @@ -1,39 +0,0 @@ -// -//使用方法 -// -//apply from: 'tencent-setup.gradle' -// - -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - classpath 'org.yaml:snakeyaml:1.17' - } -} - -android { - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -apply plugin: TencentSetupPlugin - -class TencentSetupPlugin implements Plugin { - @Override - void apply(Project target) { - target.plugins.withId('com.android.application') { - File root_project_dir = target.rootProject.projectDir.parentFile - File pubspec = new File(root_project_dir, 'pubspec.yaml') - def cfg = new org.yaml.snakeyaml.Yaml().load(pubspec.text) - target.android.defaultConfig.manifestPlaceholders += [ - TENCENT_APP_ID: cfg.tencent_kit?.app_id - ] - } - } -} diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 1f323cb..80a8e7a 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -24,7 +24,6 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" -apply from: "${project(":tencent_kit").projectDir}/tencent-setup.gradle" android { compileSdkVersion flutter.compileSdkVersion