2014-07-21 15 views
7

tôi giới thiệu lọ Quảng trường sau cho một tính năng tôi đang làm việc trên:Vấn đề sử dụng lọ mới nhất từ ​​Square - cho thêm, okhttp, okio và okhttp-URLConnection

  • okttp-2.0.0
  • okhttp- URLConnection-2.0.0.jar
  • okio-1.0.0.jar
  • retrofit-1.6.1.jar

tôi đã tải về những từ repo maven trung ương.

Mọi thứ hoạt động tốt tại địa phương và tôi đã cam kết mã của mình với svn. Chúng tôi có một Máy chủ Jenkins CI để tạo ra các bản dựng gỡ lỗi và phát hành của chúng tôi. Điều này không thành công.

Có một số sự khác biệt giữa môi trường địa phương của tôi và Jenkins:

  • tại địa phương tôi chạy java 8, Jenkins chạy java 6
  • tại địa phương tôi chỉ sản xuất debug xây dựng, Jenkins sản xuất cả hai gỡ lỗi và phát hành xây dựng
  • tại địa phương tôi đã xây dựng các công cụ phiên bản 22.6.2, Jenkins chạy 18.0.1

Và đây là những loại vấn đề tôi nhìn thấy trong các bản ghi Jenkins:

-compile: 
    [javac] Compiling 545 source files to /var/lib/jenkins/jobs/Planner_4_10_Retrofit/workspace/Planner_4_10_Retrofit/bin/classes 
    [javac] warning: /var/lib/jenkins/jobs/Planner_4_10_Retrofit/workspace/Planner_4_10_Retrofit/libs/okhttp-2.0.0.jar(com/squareup/okhttp/OkHttpClient.class): major version 51 is newer than 50, the highest major version supported by this compiler. 
    [javac] It is recommended that the compiler be upgraded. 

    [dex] Pre-Dexing /var/lib/jenkins/jobs/Planner_4_10_Retrofit/workspace/Planner_4_10_Retrofit/libs/okhttp-urlconnection-2.0.0.jar -> okhttp-urlconnection-2.0.0-5f923d75acdde39a4616800eb222e1bf.jar 
      [dx] 
      [dx] trouble processing: 
      [dx] bad class file magic (cafebabe) or version (0033.0000) 
      [dx] ...while parsing com/squareup/okhttp/internal/huc/CacheAdapter.class 
      [dx] ...while processing com/squareup/okhttp/internal/huc/CacheAdapter.class 

    [proguard] Initializing... 
    [proguard] Warning: retrofit.RxSupport$1: can't find superclass or interface rx.Observable$OnSubscribe 
    [proguard] Warning: okio.DeflaterSink: can't find referenced method 'int deflate(byte[],int,int,int)' in class java.util.zip.Deflater 
    [proguard] Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 
    [proguard] Warning: okio.Okio: can't find referenced class java.nio.file.Files 
    [proguard] Warning: retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod 
    [proguard] Warning: retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory 
    [proguard] Warning: retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService 
    [proguard] Note: there were 10 unresolved dynamic references to classes or interfaces. 
[proguard]  You should check if you need to specify additional program jars. 
[proguard] Warning: there were 90 unresolved references to classes or interfaces. 
[proguard]   You may need to specify additional library jars (using '-libraryjars'). 
[proguard] Warning: there were 1 unresolved references to program class members. 
[proguard]   Your input classes appear to be inconsistent. 
[proguard]   You may need to recompile them and try again. 
[proguard]   Alternatively, you may have to specify the option 
[proguard]   '-dontskipnonpubliclibraryclassmembers'. 

Ngay cả trên Jenkins, trình gỡ lỗi cho biết đã vượt qua nhưng không thể xây dựng bản phát hành. Có phải vấn đề chỉ là Proguard?

tôi đã tìm thấy một số cài đặt, tập tin Proguard hiện tại của tôi có các chỉ thị sau đây về libs:

-dontwarn com.squareup.okhttp.** 
-keep class retrofit.** { *; } 
-keepclasseswithmembers class * { 
@retrofit.http.* <methods>; 
} 

Với rất nhiều sự khác biệt, tôi đang cố gắng để tìm ra thủ phạm có khả năng! Bất kỳ ý tưởng bắt đầu từ đâu? Tôi không muốn thay đổi configurstion trên jenkins nếu tôi có thể lấy đi chỉ với những thay đổi proguard.

Trả lời

0

Cập nhật dx, một phần của SDK Android của bạn.

16

Điều này cuối cùng đã được giải quyết nhưng yêu cầu nhiều thay đổi.

  1. Tôi đã cập nhật jdk thành 7 trên nút đang chạy Jenkins.
  2. tôi cập nhật các công cụ sdk android
  3. tôi đã thêm dòng sau vào Proguard:..

    -dontwarn com.facebook.android.BuildConfig 
    
    -dontwarn rx.** 
    
    -dontwarn okio.** 
    
    -dontwarn com.squareup.okhttp.* 
    
    -dontwarn retrofit.appengine.UrlFetchClient 
    
    -keepattributes *Annotation* 
    
    -keep class retrofit.** { *; } 
    
    -keepclasseswithmembers class * { 
        @retrofit.http.* <methods>; 
    } 
    
    -keepattributes Signature 
    
+0

Thêm -dontwarn java.util.zip ** và java.util.zip -dontnote * * đã làm cho tôi – jfcartier

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