adwiv / android-fat-aar

Gradle script that allows you to merge and embed dependencies in generted aar file
The Unlicense
1.46k stars 435 forks source link

Could not find property 'generateReleaseAssets' #1

Closed ahtokca closed 8 years ago

ahtokca commented 9 years ago

Hi

I use gradle 2.5 and fat-aar spits the exception below. Which version of gradle is supported?

groovy.lang.MissingPropertyException: Could not find property 'generateReleaseAssets' on project ':api-impl'.
        at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
        at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
        at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:97)
        at org.gradle.groovy.scripts.BasicScript.propertyMissing(BasicScript.java:66)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:873)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1852)
        at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3689)
        at groovy.lang.GroovyObjectSupport.getProperty(GroovyObjectSupport.java:36)
        at groovy.lang.Script.getProperty(Script.java:56)
        at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:168)
        at groovy.lang.Closure.getPropertyTryThese(Closure.java:321)
        at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:315)
        at groovy.lang.Closure.getProperty(Closure.java:304)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
adwiv commented 9 years ago

@ahtokca The current gradle I use is 2.2.1. But that task should be generated by Android Library Plugin and should depend on that. Are you doing a debug build for the library project? Can you send the list of tasks being executed in the :api-impl project?

adwiv commented 9 years ago

Also please let me know your android plugin version. I currently use com.android.tools.build:gradle:1.2.3

ahtokca commented 9 years ago

I use 1.3.0beta4, but I tried 1.2.3 - no luck Another thing I'm struggling with is to make embedded dependencies per buildType

it seems I have do something like below

tasks.findAll { task ->
        if (task.name.matches('generate.*?Assets')) {
            println "task found + " + task.name;
            // Merge Assets
            task.dependsOn embedAssets
        } else if (...) {
        }

    }
adwiv commented 9 years ago

The embedding is only useful for the release builds, not for the debug builds probably used by test instrumentation. Are you using flavors? Since I am only using release builds, I did not put checks around the task names. Maybe I'll need do that.

A better way may be to attach the task dependencies using build variants. That might work for multiple flavors too. However, it would then also require changing the hardcoded paths in some of the tasks.

If you can give me some idea about the project (flavors, build types) or a sample I can try it out.

ahtokca commented 9 years ago

Well there is one flavor, however different build types. The build type defines which dependencies to embed and which obfuscation mechanism to use. That's basically it.

adwiv commented 9 years ago

Thats quite complex thing for me :) The current version only supports single build type - release with default flavor.

Since you want to have different embed dependencies per build type, you will have to generate configurations for each like compile does. We can use fooCompile when defining a dependency if we have a build type named foo and it will be used only with foo build. Something similar can be done here.

However an easier way might be to create a different library project per build type if you want to use it as it is.

ahtokca commented 9 years ago

Anyway thank you very much. I don't need to merge any resource/assest etc. Just classes. So I almost made my script taking yours as an example