当前位置:网站首页>The whole process of Tinker access --- configuration
The whole process of Tinker access --- configuration
2022-08-11 06:37:00 【rest of my life love static】
接入全流程
配置Gradle
1、项目gradle
2、app moudle
apply plugin: 'com.android.application'
android {
signingConfigs {
release {
keyAlias 'tinker'
keyPassword 'tinker123456'
storeFile file('tinkerDemo.jks')
storePassword 'tinker123456'
}
}
compileSdkVersion 28
defaultConfig {
applicationId "smt.com.tinkerdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 0
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
// 编译选项
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
// recommend
dexOptions {
jumboMode = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// 多dex配置
implementation 'com.android.support:multidex:1.0.2'
// 本地集成aar方式
// compile(name: 'bugly_crashreport_upgrade-1.3.6', ext: 'aar')
// Remote dependency integration(推荐)
implementation 'com.tencent.bugly:crashreport_upgrade:1.3.6'
// 指定tinker依赖版本(注:应用升级1.3.5版本起,不再内置tinker)
implementation 'com.tencent.tinker:tinker-android-lib:1.9.9'
}
// 依赖插件脚本
apply from: 'tinker-support.gradle'
3、tinker-support.gradle配置
apply plugin: 'com.tencent.bugly.tinker-support'
def bakPath = file("${buildDir}/bakApk/")
/**
* 此处填写每次构建生成的基准包目录
*/
def baseApkDir = "app-0716-17-36-08" [email protected]
/**
* 对于插件各参数的详细解析请参考
*/
tinkerSupport {
// 开启tinker-support插件,默认值true
enable = true
// 指定归档目录,默认值当前module的子目录tinker
autoBackupApkDir = "${bakPath}"
// 是否启用覆盖tinkerPatch配置功能,默认值false
// 开启后tinkerPatch配置不生效,即无需添加tinkerPatch
overrideTinkerPatchConfiguration = true [email protected]
// 编译补丁包时,必需指定基线版本的apk,默认值为空
// 如果为空,则表示不是进行补丁包的编译
// @{link tinkerPatch.oldApk }
baseApk = "${bakPath}/${baseApkDir}/app-release.apk"
// 对应tinker插件applyMapping
baseApkProguardMapping = "${bakPath}/${baseApkDir}/app-release-mapping.txt"
// 对应tinker插件applyResourceMapping
baseApkResourceMapping = "${bakPath}/${baseApkDir}/app-release-R.txt"
// 构建基准包和补丁包都要指定不同的tinkerId,并且必须保证唯一性
tinkerId = "patch-1.1.0" ------[email protected]3
// 构建多渠道补丁时使用
// buildAllFlavorsDir = "${bakPath}/${baseApkDir}"
// 是否启用加固模式,默认为false.(tinker-spport 1.0.7起支持)
// isProtectedApp = true
// 是否开启反射Application模式
enableProxyApplication = false [email protected]
// 是否支持新增非export的Activity(注意:设置为true才能修改AndroidManifest文件)
supportHotplugComponent = true
}
/**
* 一般来说,我们无需对下面的参数做任何的修改
* 对于各参数的详细介绍请参考:
* https://github.com/Tencent/tinker/wiki/Tinker-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97
*/
tinkerPatch { --------------------------------------------------- @5
//oldApk ="${bakPath}/${appName}/app-release.apk"
ignoreWarning = false
useSign = true
dex {
dexMode = "jar"
pattern = ["classes*.dex"]
loader = []
}
lib {
pattern = ["lib/*/*.so"]
}
res {
pattern = ["res/*", "r/*", "assets/*", "resources.arsc", "AndroidManifest.xml"]
ignoreChange = []
largeModSize = 100
}
packageConfig {
}
sevenZip {
zipArtifact = "com.tencent.mm:SevenZip:1.1.10"
// path = "/usr/local/bin/7za"
}
buildConfig {
keepDexApply = false
//tinkerId = "1.0.1-base"
//applyMapping = "${bakPath}/${appName}/app-release-mapping.txt" // 可选,设置mapping文件,建议保持旧apk的proguard混淆方式
//applyResourceMapping = "${bakPath}/${appName}/app-release-R.txt" // 可选,设置R.txt文件,通过旧apk文件保持ResId的分配
}
}
说明
@1:Here is the path to the benchmark package:role is important、很重要、很重要,Its role is that the patch package is under this pathapkThe file is the patch package generated by the benchmark
@2:如果设置为false,则@5The configuration at will not take effect;如果设置为true,则@5The configuration here takes effect
@3:Must be unique here,Both and the current benchmark package,还是之前的版本,Must be unique,唯一性、唯一性、唯一性,Each time a patch package is generated,每次、每次、每次,都要保持唯一
@4:如果设置为true,我们不需要继承TinkerApplication,只需要继承原生Application即可,TinkerReflection will be used,修改Application;如果设置为false,我们需要自定义MyApplicationLike继承DefaultApplicationLike,MyApplication继承TinkerApplication
MyApplicationLike
public class MyApplicationLike extends DefaultApplicationLike {
public MyApplicationLike(Application application, int tinkerFlags, boolean tinkerLoadVerifyFlag, long applicationStartElapsedTime, long applicationStartMillisTime, Intent tinkerResultIntent) {
super(application, tinkerFlags, tinkerLoadVerifyFlag, applicationStartElapsedTime, applicationStartMillisTime, tinkerResultIntent);
}
@Override
public void onCreate() {
super.onCreate();
Bugly.setIsDevelopmentDevice(getApplication(),true); [email protected]
// 这里实现SDK初始化,appId替换成你的在Bugly平台申请的appId
Bugly.init(getApplication(), "98552355", true);
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
// you must install multiDex whatever tinker is installed!
MultiDex.install(base);
// TODO: 安装tinker
Beta.installTinker(this);
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void registerActivityLifecycleCallback(
Application.ActivityLifecycleCallbacks callbacks) {
getApplication().registerActivityLifecycleCallbacks(callbacks);
}
@Override
public void onTerminate() {
super.onTerminate();
Beta.unInit();
}
}
@6:This configuration sets the current device as a development device,对应buglyHot update update the patch distribution range.**开发设备:**Patch distribution will only be distributed to the configuration that is called when runningtrue的设备;**全量设备:**Is the patch distributed to all devices
MyApplication
public class MyApplication extends TinkerApplication {
/**
* current build.
*
*/
public MyApplication() {
super(ShareConstants.TINKER_ENABLE_ALL, "smt.com.tinkerdemo.MyApplicationLike",
"com.tencent.tinker.loader.TinkerLoader", false);
}
}
边栏推荐
- Day 86
- OpenMLDB: Consistent production-level feature computing platform online and offline
- 8-byte standard request parsing during USB enumeration
- Typescript学习日记,typescript从基础到进阶(第一章)
- [Meetup]OpenMLDBxDolphinScheduler 链接特征工程与调度环节,打造端到端MLOps工作流
- vim 编辑解决中文乱码问题
- Building a data ecology for feature engineering - Embrace the open source ecology, OpenMLDB fully opens up the MLOps ecological tool chain
- Goldbach's conjecture and the ring of integers
- Jetpack use exception problem collection
- Day 80
猜你喜欢

Day 82

第四范式OpenMLDB优化创新论文被国际数据库顶会VLDB录用

USB URB

OpenMLDB Pulsar Connector: Efficiently connect real-time data to feature engineering

He Kaiming's new work ViTDET: target detection field, subverting the concept of layered backbone

【无标题】

何凯明新作ViTDET:目标检测领域,颠覆分层backbone理念

活动预告 | 4月23日,多场OpenMLDB精彩分享来袭,不负周末好时光

127.0.0.1 connection refused

ARM assembly instruction ADR and LDR
随机推荐
Node stepping on the pit 80 port is occupied
Goldbach's conjecture and the ring of integers
Day 81
Day 70
js学习进阶BOM部分(pink老师笔记)
哥德巴赫猜想与整数环
Real-time Feature Computing Platform Architecture Methodology and Practice Based on OpenMLDB
Here is a memorial
使用c语言实现井字棋(有源码,可以直接运行)
Use the adb command to manage applications
OpenMLDB v0.5.0 发布 | 性能、成本、灵活性再攀高峰
The Summer of Open Source 2022 is coming | Welcome to sign up for the OpenMLDB community project~
openlayer中实现截图框截图的功能
Building a data ecology for feature engineering - Embrace the open source ecology, OpenMLDB fully opens up the MLOps ecological tool chain
开源机器学习数据库OpenMLDB贡献者计划全面启动
OpenMLDB Pulsar Connector:高效打通实时数据到特征工程
论文解读:跨模态/多光谱/多模态检测 Cross-Modality Fusion Transformer for Multispectral Object Detection
Byte (byte) and bit (bit)
STM32-库函数-SetSysClock(void)函数解析-正点原子探索者
vscode插件开发——懒人专用markdown插件开发