Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

public static runtime incremental change - android

I have a simple class named A which has two private fields.

public class A {

    private String a;
    private String b;
} // A

When I get all declared fields from class instance, I get one extra field named $change of type com.android.tools.fd.runtime.IncrementalChange. Where is it coming from ? I am totally not getting this.

Field[] fields = cls.getDeclaredFields();
        for (int i = 0, len = fields.length; i < len; i++) {
            Field field = fields[i];
            field.setAccessible(true);
            Log.d("TAG", field.getName());
            if (field.isAnnotationPresent(Primary.class)) {
                query += getFromalName(field.getName()).toUpperCase() + " " + getSchemaType(field.getType().getSimpleName()) + " PRIMARY KEY, ";
                continue;
            }
            if (field.isAnnotationPresent(NotNull.class)) {
                query += getFromalName(field.getName()) + " " + getSchemaType(field.getType().getSimpleName()) + " NOT NULL, ";
                continue;
            }
            query += getFromalName(field.getName()) + " " + getSchemaType(field.getType().getSimpleName()) + ", ";
        } // end for

        query = query.substring(0, query.lastIndexOf(","));
        query += " )";

Here is the snapshot

Snapshot 2

like image 820
mallaudin Avatar asked Mar 26 '16 13:03

mallaudin


1 Answers

It was added to support instant run. Disabling instant run solved the problem. here

is the link to android issue tracker

like image 111
mallaudin Avatar answered Oct 05 '22 08:10

mallaudin