2016-04-07 61 views
0

我在我當前的應用程序中使用Volley庫進行聯網。主項目和aar模塊之間的依賴衝突 - 排隊

相關性:

compile 'com.mcxiaoke.volley:library:1.0.19' 

我提供了一個自定義實現我的ImageLoader的覆蓋需要我的服務器一些頭。

下面的代碼:

public class MyImageLoader extends ImageLoader { 


    public MyImageLoader(RequestQueue queue, ImageCache imageCache) { 
     super(queue, imageCache); 
    } 

    @Override 
    protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight, 
              ImageView.ScaleType scaleType, final String 
                cacheKey) { 

     return new ImageRequest(requestUrl, new Response.Listener<Bitmap>() { 
     @Override 
     public void onResponse(Bitmap response) { 
      onGetImageSuccess(cacheKey, response); 
     } 
    }, maxWidth, maxHeight, scaleType, Bitmap.Config.RGB_565, new Response.ErrorListener() { 
     @Override 
     public void onErrorResponse(VolleyError error) { 
      onGetImageError(cacheKey, error); 
     } 
    }) { 
     @Override 
     public Map<String, String> getHeaders() throws AuthFailureError { 
      HashMap<String, String> params = new HashMap<>(); 
      //add my params 
      return params; 
     } 
    }; 
} 

}

我還使用了LinkedIn整合LinkedIn SDK AAR。

相關片段:

compile(name:'linkedin-sdk-debug', ext:'aar') 

repositories{ 
    flatDir{ 
     dirs 'libs' 
    } 
} 

這AAR還引用了自己的抽射版本,這是在LinkedIn SDK項目罐子。

建立我的項目是好的,但是當我運行它,我收到了一堆錯誤:

錯誤如下:

錯誤:(17,9)錯誤:類ImageRequest構造ImageRequest不能適用於給定類型; 要求:字符串,監聽器,INT,INT,配置,ErrorListener

發現:字符串,監聽器,INT,INT,ScaleType,配置,ErrorListener 原因:實際的和正式的參數列表的長度不同

錯誤: (40,16)錯誤:類ImageRequest中的構造函數ImageRequest不能應用於給定的類型; 要求:字符串,監聽器,INT,INT,配置,ErrorListener 發現:字符串,>,INT,INT,ScaleType,配置, 原因:實際的和正式的參數列表的長度不同

我懷疑這可能是由於在不同的排球代碼版本中發生衝突。

有沒有人有過這種情況?

+0

你從哪裏得到了這個linkedin-sdk-debug.arr? – djodjo

+0

@djodjo從他們的網站上的LinkedIn郵政編碼https://developer.linkedin.com/docs/android-sdk – AndroidEnthusiast

+0

在這個zip文件中,你的代碼不是空的,而且你在一個單獨的文件夾中排球 – djodjo

回答

0

在LinkedIn拉鍊你有凌空在一個單獨的模塊,所以我建議你做你的項目,美有3個模塊:

1)你的代碼

2)LinkedIn代碼

3) - 共同凌空代碼和編譯項目( ':凌空')在1)和2) OR - 使用編譯 'com.android.volley:凌空:1.0.0' 1)和2)

注意如果你想堅持排除其小心呃使用

com.android.volley:volley

com.mcxiaoke.volley:library

不能維持了。

+0

我剛剛移除了齊射瓶,並將依賴關係更改爲同一個。謝謝 – AndroidEnthusiast