My app/build.gradle says at the end "apply from: 'other.gradle'". The 
other.gradle file is very simple and contains the following:

buildscript {

    repositories {

        jcenter()

    }

    dependencies {

        // Needed for com.android.build.api classes

        classpath 'com.android.tools.build:gradle-api:2.3.1'

    }

}


import com.android.build.api.transform.QualifiedContent

import com.android.build.api.transform.Transform


// Stub implementation

class MyTransform extends Transform {

    @Override

    String getName() {

        return null

    }


    @Override

    Set<QualifiedContent.ContentType> getInputTypes() {

        return null

    }


    @Override

    Set<QualifiedContent.Scope> getScopes() {

        return null

    }


    @Override

    boolean isIncremental() {

        return false

    }

}


Class parameterClass


for (def method : android.getClass().getMethods()) {

    if (method.getName() == "registerTransform") {

        parameterClass = method.getParameterTypes()[0]

        println 'Class of first parameter to android.registerTransform: ' + 
parameterClass

    }

}


Class superClass = MyTransform.class.getSuperclass()

println 'Class of parameter that we want to pass to android.registerTransform: 
' + superClass

println 'Are the names of the two types equal? ' + 
superClass.getCanonicalName().equals(parameterClass.getCanonicalName())

println 'Are the two types equal? ' + superClass.equals(parameterClass)


*// This fails with:*

*// 
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:
 Could*

*// not find method registerTransform() for arguments [MyTransform@cac15ac] on 
object of type*

*// com.android.build.gradle.AppExtension.*

android.registerTransform(new MyTransform())


Why is this occuring? How can it be dealt with?

The printlns suggest that the superclass of MyTransform is a different type 
from the first parameter to registerTransform(), but I don't understand how 
that could be. The names match, but somehow the types are not the same.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to