码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Android 出海aab的资源混淆(兼容gradle7.0+)


    由于项目出海, 需要对app进行各方面的混淆,避免马甲包,以及规避被恶意攻击的风险;  其中一方面就是对资源的混淆, 发现了一个可用的库

    https://github.com/bytedance/AabResGuard

    但但是, 这个插件github上最新版本是 0.1.9, Gradle插件7.0+会报错: 

    • Type 'com.bytedance.android.plugin.tasks.AabResGuardTask' property 'aabResGuard' is missing an input or output annotation.
    • Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    不用担心, 网上已经有人给出了解决方式:

    [Gradle issue] Gradle 7.0 编译问题 · Issue #75 · bytedance/AabResGuard · GitHub 

     没错,有人已经适配了gradle7.0并发布了0.1.10版本, 需要到特有的仓库去下载;

    下面就是完整的接入流程:

    1.首先添加插件依赖:

    root/build.gradle

    1. buildscript {
    2. repositories {
    3. google()
    4. mavenCentral()
    5. mavenLocal()
    6. maven { url 'https://raw.githubusercontent.com/martinloren/AabResGuard/mvn-repo' }
    7. }
    8. dependencies {
    9. //......
    10. //AabResGuard
    11. classpath "com.bytedance.android:aabresguard-plugin:0.1.10"
    12. }
    13. }

    2.自定义一个aab_proguard.gradle

    1. apply plugin: "com.bytedance.android.aabResGuard"
    2. aabResGuard {
    3. mappingFile = file("mapping.txt").toPath() // Mapping file used for incremental obfuscation
    4. whiteList = [ // White list rules
    5. "*.R.raw.*",
    6. "*.R.drawable.icon",
    7. "*.R.string.default_web_client_id",
    8. "*.R.string.firebase_database_url",
    9. "*.R.string.gcm_defaultSenderId",
    10. "*.R.string.google_api_key",
    11. "*.R.string.google_app_id",
    12. "*.R.string.ga_trackingId",
    13. "*.R.string.google_crash_reporting_api_key",
    14. "*.R.string.google_storage_bucket",
    15. "*.R.string.project_id",
    16. "*.R.string.*google*"
    17. ]
    18. obfuscatedBundleFileName = "duplicated-app.aab" // Obfuscated file name, must end with '.aab'
    19. mergeDuplicatedRes = true // Whether to allow the merge of duplicate resources
    20. enableFilterFiles = true // Whether to allow filter files
    21. filterList = [ // file filter rules
    22. // "*/arm64-v8a/*",
    23. "META-INF/*"
    24. ]
    25. enableFilterStrings = false // switch of filter strings
    26. unusedStringPath = file("unused.txt").toPath() // strings will be filtered in this file
    27. languageWhiteList = ["en", "zh"] // keep en,en-xx,zh,zh-xx etc. remove others.
    28. }

    3.引入插件以及配置:

    app/build.gradle

        apply from:'aab_res_proguard.gradle'

    4.执行打包aab, 生成的混淆后的aab在 build/output/bundle/xxxx/duplicated_app.aab

    其他参考:

    AabResGuard添加依赖总结_碧云天丶的博客-CSDN博客

    AabResGuard from sebthom - DevPick.io

  • 相关阅读:
    软考中级(系统集成项目管理工程师)高频考点
    解密Kubernetes(K8s)集群的创建过程和关键步骤
    关于Redux的学习
    线程(中):线程安全
    基于51单片机霍尔传感器测速(仿真+源程序)
    TCP优化二:TCP 四次挥手性能优化
    SpringBoot笔记梳理
    基于检索增强的 GPT-3.5 的文本到 SQL 框架,具有样本感知提示和动态修订链。
    “凌特杯”通信系统设计大赛,题目解析
    Json“牵手”易贝商品详情数据方法,易贝商品详情API接口,易贝API申请指南
  • 原文地址:https://blog.csdn.net/qq_23992393/article/details/126896041
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号