El funcionamiento inmediato no funciona

Condición previa

Desde que uso android studio 2.0 (versión de lanzamiento) consigo muchos errores internos de la clase al compilar mi app (ésos parecen no ser relevantes, pues la aplicación todavía trabaja muy bien). Cuando desactivo la ejecución instantánea, mi aplicación funciona perfectamente bien, si la habilito, la aplicación se bloquea

Observaciones

Los errores durante la compilación son los siguientes:

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(com.samsung.android.sdk.pass.e) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(com.samsung.android.sdk.pass.a) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(com.samsung.android.sdk.pass.b) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(com.samsung.android.sdk.pass.c) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(com.samsung.android.sdk.pass.d) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegImageParser$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegImageParser$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegImageParser$3) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegImageParser$4) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegImageParser$5) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.JpegUtils$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.exifRewrite.ExifRewriter$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.iptc.IPTCParser$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.iptc.IPTCRecord$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.xmp.JpegRewriter$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.xmp.JpegRewriter$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.xmp.JpegRewriter$3) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.jpeg.xmp.JpegRewriter$4) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.tiff.TiffElement$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.tiff.write.TiffOutputDirectory$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.tiff.write.TiffImageWriterLossless$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.formats.tiff.write.TiffImageWriterLossless$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.icc.IccConstants$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.icc.IccConstants$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.icc.IccConstants$3) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.icc.IccConstants$4) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.icc.IccConstants$5) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.palette.MedianCutQuantizer$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.sanselan.palette.MedianCutQuantizer$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. 

Posteriormente obtienes errores al iniciar la aplicación como siguiente (SOLO con la ejecución instantánea habilitada):

 com.app.test.data.DataManager$ExistingDataSources; Incompatible class (SUID): com.app.test.data.DataManager$ExistingDataSources: static final long serialVersionUID =4867698184298054210L; but expected com.app.test.data.DataManager$ExistingDataSources: static final long serialVersionUID =2877622586407293138L; java.io.InvalidClassException: com.app.test.data.DataManager$ExistingDataSources; Incompatible class (SUID): com.app.test.data.DataManager$ExistingDataSources: static final long serialVersionUID =4867698184298054210L; but expected com.app.test.data.DataManager$ExistingDataSources: static final long serialVersionUID =2877622586407293138L; 

El registro completo está aquí: https://gist.github.com/MFlisar/3514ad2af4b4de692d228da0e1264015

Pregunta

¿Qué significa eso para mí? Que tengo que clonar todas las bibliotecas que se mencionan en el bloque de error de compilación grande y compilarlos localmente en lugar de importarlos a través de gradle?

Lo que está sucediendo es que no definió su propio serialVersionUID para su clase serializable y por lo que el JDK calcular su propia. Sin embargo, la versión calculada difiere al crear con Instant-Run (IR) habilitado vs deshabilitado. Por lo tanto, usar una versión de la aplicación con IR fallará al cargar las clases serializadas sin ella, ya que el UID es diferente.

La solución es definir su propio serialVersionUID en todas las clases que serialVersionUID . Es la mejor práctica de serialización de Java de todos modos

Desactivar los problemas solucionados de Instant Run que tuve con Services, Classes and Fragments

Preferencias> Creación, Ejecución, Implementación> Ejecución instantánea> Desactive "Habilitar ejecución instantánea"

Sin embargo, si desea mantener Instant Run puede probar con sólo UnChecking "Actividad de reinicio en los cambios de código"

Preferencias> Creación, ejecución, implementación> Ejecución instantánea> Desmarque "Actividad de reinicio en los cambios de código"

Espero que ayude a alguien!

Hay muchos errores introducidos por Instant Run, pero se convirtieron cada vez menos en versiones más recientes. Debe actualizar la última versión estable de android studio y asegúrese de comprobar Gradle plugin también Si todavía no encuentra una solución con ella, a continuación, desactivar Instant ejecutar, puede hacerlo como por otra respuesta sugiere o ver esta pregunta aquí También he encontrado Esta respuesta bastante útil.

Puedes enviar un error aquí .

Añadir esta línea a proguard-rules.pro

 -keepattributes EnclosingMethod 

Este error puede ocurrir casi todas las clases que tiene InnerClasses, creo. (Como support.v4 etc) para mí.

He probado en el estudio de Android 2.2 (No probado log4j. Support.v4 probado, etc)

Construir un gradiente

 compileSdkVersion 24 buildToolsVersion "24.0.2" ... minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' ... dependencies { ... compile 'com.android.support:support-v4:24.2.1' } 

GetDefaultProguardFile ('proguard-android-optimize.txt') también funciona.

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.