vanniktech / gradle-android-apk-size-plugin

Gradle plugin that generates CSV files with apk size per output and variant of an apk
http://vanniktech.com
Apache License 2.0
84 stars 14 forks source link

How can you use it from the plugins repo? #33

Closed jaredsburrows closed 8 years ago

jaredsburrows commented 8 years ago

@vanniktech

Example:

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }      // Mirrors jcenter() and mavenCentral()
    }

    dependencies {
        // Android gradle plugin
        classpath "com.android.tools.build:gradle:2.1.2"
    }
}

plugins {
  id "com.vanniktech.android.apk.size" version "0.2.0"
}

Error:

$ gradlew
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/noname/repo/android-gradle-java-template/build.gradle' line: 27

* What went wrong:
An exception occurred applying plugin request [id: 'com.vanniktech.android.apk.size', version: '0.2.0']
> Failed to apply plugin [id 'com.vanniktech.android.apk.size']
   > APK Size Plugin requires the Android Application plugin to be configured

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.816 secs
vanniktech commented 8 years ago

Hmm what type is the project android-gradle-java-template? Also does it work if you don't use the new Gradle Plugin mechanism?

jaredsburrows commented 8 years ago

It is an android example, see here: https://github.com/jaredsburrows/android-gradle-java-app-template/blob/master/build.gradle#L10.

Yes, I have used your plugin since the beginning! It works find in the buildscript block just not when using the plugins block because the Android gradle plugin does not support the plugins block yet.

vanniktech commented 8 years ago

Uh nice template project there. Well then I guess it's more of a limitation of the Android Gradle Plugin, I am also only using it via the old way and not the new plugin mechanism.

I also tried locally to set up it up with plugins and I could seem to get it working. Sorry for that. Do you know whether there's anything we as library devs can do?

Regarding the tools you're also providing there, I have a bunch of them abstracted to make easier use of them and not reduce boiler plate in every project. Any feedback is welcome

jaredsburrows commented 8 years ago

Thanks. You notice I do use your plugin but I am trying to convert everything to the plugins block.

This is a limitation by the Android gradle plugin, I just wanted to see if you knew of a work around.

Thanks for the tools! I like to configure some of the tools myself to be able to show and teach others how to use Gradle and get them started on writing their own build.gradle files.

So I guess, we can close this until Google makes their plugin available on plugins.gradle.org.