2016-04-14 12 views
7

kiện tiên quyếtRun tức thì không làm việc

Kể từ khi tôi sử dụng Android Studio 2.0 (phiên bản Release) tôi nhận được nhiều erros lớp bên trong khi biên dịch ứng dụng của tôi (những người dường như không có liên quan, như các ứng dụng vẫn hoạt động tốt). Khi tôi vô hiệu hóa chạy ngay lập tức, ứng dụng của tôi làm việc hoàn toàn tốt đẹp, nếu tôi bật nó, ứng dụng bị treo

Quan sát

Các lỗi khi biên dịch đang theo dõi:

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. 

Sau đó tôi nhận được lỗi khi bắt đầu ứng dụng như sau (CHỈ với chạy ngay lập tức được bật):

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; 

Toàn bộ nhật ký ở đây : https://gist.github.com/MFlisar/3514ad2af4b4de692d228da0e1264015

Câu hỏi

Điều đó có ý nghĩa gì đối với tôi? Rằng tôi phải sao chép tất cả các thư viện được đề cập trong khối lỗi xây dựng lớn và biên dịch chúng cục bộ thay vì nhập chúng qua gradle?

+0

nhật ký khi ứng dụng gặp sự cố là gì ?? –

+0

Có vẻ như một vấn đề bảo vệ. Bạn đã thêm '-keepclassmembers class * thực hiện java.io.Serializable' chưa? –

+0

Tôi đã thêm một gist với nhật ký có liên quan hoàn chỉnh ... @PedroOliveira Tôi đã vô hiệu hóa proguard để gỡ lỗi xây dựng ... Thêm quy tắc proguard không thay đổi bất cứ điều gì ... – prom85

Trả lời

0

Vô hiệu hóa Run tức thì giải quyết vấn đề tôi đã có với dịch vụ, lớp và Những mảnh vỡ

Preferences> Xây dựng, thi công, triển khai> Run tức thì> Bỏ chọn "Enable Run tức thì"

Tuy nhiên, nếu bạn muốn giữ Instant Run, bạn có thể thử chỉ bằng cách bỏ chọn "Khởi động lại hoạt động trên các thay đổi mã"

Tuỳ chọn> Xây dựng, thực thi, triển khai> Chạy tức thì> Unche ck "Khởi động lại hoạt động trên các thay đổi mã"

Hy vọng nó sẽ giúp ai đó!

0

Có nhiều lỗi được giới thiệu bởi Instant Run nhưng chúng trở nên ngày càng ít trong các phiên bản mới hơn. Bạn nên cập nhật phiên bản ổn định mới nhất của android studio và chắc chắn về kiểm tra plugin Gradle cũng Nếu bạn vẫn không tìm thấy giải pháp với nó thì tắt Instant chạy, bạn có thể làm điều đó theo câu trả lời khác hoặc xem câu hỏi này here Tôi cũng tìm thấy this answer khá hữu ích.

Bạn có thể submit bug here về việc đó.

3

Điều đang xảy ra là bạn không xác định serialVersionUID của riêng bạn cho lớp có thể tuần tự hóa của bạn và do đó JDK tính toán riêng của nó. Tuy nhiên, phiên bản tính toán khác nhau khi xây dựng với tính năng Instant-Run (IR) được bật và tắt. Vì vậy, việc sử dụng phiên bản ứng dụng có IR sẽ không tải lại các lớp được tuần tự hóa được tạo mà không có nó vì UID khác.

Giải pháp là xác định serialVersionUID của riêng bạn trong tất cả các lớp mà bạn sắp xếp theo thứ tự.It's best Java Serialization practice anyway

+0

Tôi vừa đọc về khối CommonsWare ... Tôi sẽ kiểm tra điều đó. Tôi khá chắc chắn rằng tôi đã tự định nghĩa lại UID, nhưng tôi sẽ thử lại ... – prom85

0

Thêm dòng này để proguard-rules.pro

-keepattributes EnclosingMethod 

Lỗi này có thể xảy ra hầu hết mọi tầng lớp trong đó có InnerClasses, tôi nghĩ. (như support.v4 vv) cho tôi.

Tôi đã thử nghiệm trên Android studio 2.2 (Không kiểm tra log4j. Tested support.v4 vv)

build.gradle

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') cũng hoạt động.

Các vấn đề liên quan