question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Android Gradle Plugin 3.0

See original GitHub issue

Android Gradle Plugin (下称 AGP) 3.0 相对于 2.3.0 有了大幅的 API 改动。 导致我们的 gradle-small 编译插件在以下重要环节出现了问题:

  1. 解析 aar 依赖
  2. 分离 class
  3. 分离 arsc
  4. 分离 JNI
  5. 分离 manifest
  6. 分离 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:open
  • Created 6 years ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
galenlincommented, Dec 9, 2017

@navyifanr 不会

0reactions
tangkoucancommented, Jun 4, 2019

@kumarswamy-repo Yes, it’s incubating, you can checkout the support-android-gradle-3.0 branch and try the DevSample source project.

support-android-gradle-3.0 DevSample分支跑不起来: 报错:You need to use a Theme.AppCompat theme (or descendant) with this activity。我已经将Theme适配还是不行。 AS:3.0 gradle:3.0.1

metoo

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found