Support for Android Gradle Plugin 3.0
See original GitHub issueAndroid Gradle Plugin
(下称 AGP) 3.0 相对于 2.3.0 有了大幅的 API 改动。
导致我们的 gradle-small
编译插件在以下重要环节出现了问题:
- 解析 aar 依赖
- 分离 class
- 分离 arsc
- 分离 JNI
- 分离 manifest
- 分离 assets
为解决该适配问题,Small 决定重新设计编译流程,前置分离过程,减少不必要的后期 transform hook。同时彻底弃用原有对 AGP 私有 API 的引用,为以后兼容性打下基础。
拟采取以下方案(打钩项目已完成):
- 1. 预处理:解析 aar 依赖,对等构造一批仅包含
res
目录的 aar 文件,提前完成Jar
,JNI
,Manifest
,Assets
等文件分离 - 2. 重定向:通过动态构造 flatDir repo,引用上述裁剪版的 aar 依赖
- 3. 分离三方库:根据 (1) 中依赖,动态
compileOnly
当前插件模块所需的jar
- 4. 分离
R.class
:通过对aapt
,javac
task 的 hook,构造一个仅含当前模块所需的R.class
- [x ] 5. 分离
ap_
:解压ap_
文件,分离非模块自身的res
资源,并重新构造一个经过剪裁的arsc
文件 - 6. 混淆适配
方案改造后,将完美适配 AGP 3.0。 同时新方案将大量的 I/O 操作前置到预处理过程,并良好地利用 Gradle Task Up-To-Date 设计,预期将大幅提高编译效率。
最新进展
目前已完成初步适配,代码分支 support-android-gradle-3.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Android Gradle plugin release notes - Android Developers
The Android Studio build system is based on Gradle, and the Android Gradle plugin adds several features that are specific to building Android...
Read more >Gradle 3.0 Release Notes
This release provides the first support for Gradle Script Kotlin, which is a Kotlin-based build language for Gradle scripts. Its deep integration with...
Read more >Migrating to Android Gradle plugin 3.0.0 - YouTube
For more information about migrating to Android Gradle plugin 3.0.0 refer to the guide in our documentation: https://goo.gl/AGR95pAndroid ...
Read more >Welcome to Android Studio 3.0. It's a brave new world
Updating the IDE and plugin · Open gradle-wrapper.properties · Enter the latest version of Gradle (above 4.1) · Open build.gradle in the root...
Read more >Support Android Gradle plugin version 3.0 · Issue #3 - GitHub
Android Studio 2.3 is currently the recommended stable version, and the only one supported by Chaquopy. Version 3.0 is in beta, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@navyifanr 不会
metoo