diff --git a/README.md b/README.md index a39c854..c379393 100644 --- a/README.md +++ b/README.md @@ -27,56 +27,11 @@ Reports are generated based on the provided Android device specifications. Our [ App Sizer provides two flexible integration methods: -* A Gradle plugin that seamlessly integrates with your Android Gradle project. -* A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features. +* A Gradle plugin that seamlessly integrates with your Android Gradle project ([Plugin Configuration Detail][plugin_doc].) +* A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features ([Commandline Configuration Detail][cli_doc].) *Note: The command-line option was the original implementation and remains supported for broader compatibility.* -### Gradle Plugin Integration - -Add the plugin to your project using the Gradle plugins DSL: - -1. Add the plugin to your root `settings.gradle`: - -```groovy -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - } -} -``` -2. Apply and configure the plugin in your app module's build.gradle: - -```groovy -plugins { - id "com.grab.sizer" version "0.1.0-alpha01" -} - -appSizer { - // Configuration goes here -} -``` - -3. To run analysis: - -``` -./gradlew app:appSizeAnalysis[Release|Debug] --no-configure-on-demand --no-configuration-cache -``` - -For plugin configuration options, see [Plugin Configuration][plugin_doc]. - -### Cli Tool Integration - -1. Download our [Latest Release][latest_release_link] from GitHub -2. Ensure Java 11+ is installed - -To run analysis using the command line tool, execute -```text -java -jar cli-all.jar --config-file ./path/to/config/app-size-settings.yml -``` - -For command line configuration options, see [Commandline Configuration][cli_doc]. ## Report Types @@ -155,7 +110,7 @@ SOFTWARE [limitation_doc]:https://grab.github.io/app-sizer/limitation/ [blog_post]: https://engineering.grab.com/project-bonsai [latest_release_link]: https://github.com/grab/app-sizer/releases -[gradle_plugin]: ./gradle-plugin +[gradle_plugin]: ./sizer-gradle-plugin [commandline_tool]: ./cli [grafana_docker]: ./docker diff --git a/docs/index.md b/docs/index.md index 353d579..d372939 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,57 +26,11 @@ Reports are generated based on the provided Android device specifications. Our [ App Sizer provides two flexible integration methods: -* A Gradle plugin that seamlessly integrates with your Android Gradle project. -* A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features. +* A Gradle plugin that seamlessly integrates with your Android Gradle project ([Plugin Configuration Detail][plugin_doc].) +* A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features ([Commandline Configuration Detail][cli_doc].) *Note: The command-line option was the original implementation and remains supported for broader compatibility.* -### Gradle Plugin Integration - -Add the plugin to your project using the Gradle plugins DSL: - -1. Add the plugin to your root `settings.gradle`: - -```groovy -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - } -} -``` -2. Apply and configure the plugin in your app module's build.gradle: - -```groovy -plugins { - id "com.grab.sizer" version "0.1.0-alpha01" -} - -appSizer { - // Configuration goes here -} -``` - -3. To run analysis: - -``` -./gradlew app:appSizeAnalysis[Release|Debug] --no-configure-on-demand --no-configuration-cache -``` - -For plugin configuration options, see [Plugin Configuration][plugin_doc]. - -### Cli Tool Integration - -1. Download our [Latest Release][latest_release_link] from GitHub -2. Ensure Java 11+ is installed - -To run analysis using the command line tool, execute -```text -java -jar cli-all.jar --config-file ./path/to/config/app-size-settings.yml -``` - -For command line configuration options, see [Commandline Configuration][cli_doc]. - ## Report Types App Sizer currently supports three types of reports: @@ -151,7 +105,7 @@ SOFTWARE [cli_doc]: ./cli.md [grafana_docker_doc]: ./docker.md [limitation_doc]:./limitation.md -[gradle_plugin]: https://github.com/grab/app-sizer/tree/master/gradle-plugin +[gradle_plugin]: https://github.com/grab/app-sizer/tree/master/sizer-gradle-plugin [commandline_tool]: https://github.com/grab/app-sizer/tree/master/cli [grafana_docker]: https://github.com/grab/app-sizer/tree/master/docker [blog_post]: https://engineering.grab.com/project-bonsai diff --git a/docs/plugin.md b/docs/plugin.md index b4ffc9b..d13fc99 100644 --- a/docs/plugin.md +++ b/docs/plugin.md @@ -7,18 +7,24 @@ There are two ways to integrate the App Sizer plugin into your project: ### Option 1: Plugins DSL (Recommended) -1. Add the plugin to your root `settings.gradle`: +1. Add the mavenCentral to your root `settings.gradle`: ```groovy pluginManagement { repositories { mavenCentral() - gradlePluginPortal() } } ``` +2. Add the plugin to your project classpath (root's build.gradle): +```groovy +plugins { + id "com.grab.sizer" version "0.1.0-alpha01" apply false +} +``` + +3. Apply and configure the plugin to your app module's build.gradle: -2. Apply and configure the plugin in your app module's build.gradle: ```groovy plugins { id "com.grab.sizer" version "0.1.0-alpha01" @@ -46,14 +52,14 @@ buildscript { 2. Apply the plugin in your app module's `build.gradle` ```groovy -apply plugin: "com.grab.app-sizer" +apply plugin: "com.grab.sizer" appSizer { // Configuration goes here } ``` -3. Run the analysis +### Run the analysis ```bash ./gradlew app:appSizeAnalysis[Release|Debug] --no-configure-on-demand --no-configuration-cache @@ -233,8 +239,24 @@ appSizer { ## Troubleshooting -- If you encounter issues with the `verifyResourceRelease` task, try enabling `enableMatchDebugVariant`. -- Ensure that the `bundletool` JAR file is correctly referenced in your configuration. +### Resource Verification Failures +If you encounter issues with the `verifyResourceRelease` task, try these solutions: +- Check that your resource files are properly formatted and located +- Verify that resource names follow Android naming conventions +- Enable the `enableMatchDebugVariant` flag in your configuration + +### Dagger NoSuchMethodError +If you encounter this exception: +```java +NoSuchMethodError: 'java.lang.Object dagger.internal.Preconditions.checkNotNullFromProvides' +``` +This error typically occurs due to a version conflict between the Android build tools and the App-Sizer plugin's Dagger dependencies. To resolve: + +1. Ensure the App-Sizer plugin is added to the classpath in the root build.gradle before applying it to your app module +2. If step 1 doesn't resolve the issue, you might have to resolve the Dagger version conflict by adding this to your classpath +``` +classpath "com.google.dagger:dagger:2.47" +``` ## Resources diff --git a/sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/tasks/GenerateApkTask.kt b/sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/tasks/GenerateApkTask.kt index 16b8dce..e6967a1 100644 --- a/sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/tasks/GenerateApkTask.kt +++ b/sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/tasks/GenerateApkTask.kt @@ -193,7 +193,9 @@ internal abstract class GenerateApkTask : DefaultTask() { (it as FinalizeBundleTask).finalBundleFile.get() } ) - signingConfig.set(variant.signingConfig.toInternalSigningConfig()) + if (variant.signingConfig != null) { + signingConfig.set(variant.signingConfig.toInternalSigningConfig()) + } variantName.set(variant.name) } return task