2015-10-16 25 views
13

Tôi nhận được lỗi sau cố gắng xây dựng một thông cáo apkPro bảo vệ Lỗi xây dựng phát hành apk

:app:compileReleaseNdk UP-TO-DATE 
:app:compileReleaseSources 
:app:lintVitalRelease 
:app:proguardRelease 
Warning: android.support.v4.app.NotificationCompat$NotificationCompatImplBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification 
Warning: android.support.v4.app.NotificationCompat$NotificationCompatImplGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification 
Warning: android.support.v4.app.NotificationCompatGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification 
Warning: there were 3 unresolved references to library class members. 
     You probably need to update the library versions. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember) 
:app:proguardRelease FAILED 

Trong build.gradle Tôi có điều này:

phụ thuộc { biên dịch "com.android .Hỗ trợ: hỗ trợ-v4: 23.0.0" }

Và vẫn nhận được lỗi tương tự nếu tôi thay đổi nó để "com.android.support:support-v13:23.0.0"

Khi thông báo lỗi cho biết: "Có thể bạn cần cập nhật phiên bản thư viện". Thư viện nào là nó đề cập đến và làm thế nào để cập nhật nó?

Các tài liệu tham khảo trong các lỗi nói: "If you're developing for Android and ProGuard complains that it can't find a method that is only available in a recent version of the Android run-time, you should change the build target in your project.properties file or build.gradle file to that recent version. You can still specify a different minSdkVersion and a different targetSdkVersion in your AndroidManifest.xml file."

Đây là build.gradle của tôi, đó là vì hầu hết gần đây là có như API của nó 23. Vậy làm thế nào tôi có thể sửa chữa vấn đề?

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
     applicationId "com.cequint.ecid" 
     minSdkVersion 23 
     compileSdkVersion 23 
    } 
+0

bạn đã thử cập nhật cho 'com.android.support: hỗ trợ-v4: 23.1.0'? –

+0

Thông báo lỗi tương tự của nó sau khi cập nhật lên com.android.support:support-v4:23.1.0 – Gruntcakes

+1

Tôi đã thêm điều này vào pro guard.cfg và nó hoạt động: -dontwarn android.support.v4. ** – Gruntcakes

Trả lời

11

tôi thêm này để guard.cfg pro và nó làm việc:

-dontwarn android.support.v4.** 
+1

Bạn có thực sự sử dụng NotificationCompat và trình xây dựng của nó không? Tôi đã thêm tập tin này, nhưng bây giờ tôi nhận được ngoại lệ thời gian chạy thay vì – Nilzor

+1

Có Tôi đang sử dụng NotificationCompat. Bạn có nghĩa là bạn bắt đầu sử dụng NotificationCompat và sau đó bắt đầu nhận được trường hợp ngoại lệ khi bạn làm như vậy? Nếu bạn có thể thiếu một sự phụ thuộc trong tập tin gradle của bạn – Gruntcakes

+0

Hóa ra đó là một sự thay đổi không liên quan gây ra nó. Đừng bận tâm tôi. – Nilzor

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