E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache Error while using Picasso and okhttp in genymotion

依然范特西╮ 提交于 2019-12-18 09:09:05

问题


I'm writing an app which loads a picture from a URL and display in an imageview. here is the code...

public class MainActivity extends Activity {

private Picasso picasso;
private OkHttpClient okHttpClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ImageView imageview = (ImageView) findViewById(R.id.imageView);
    String image_url ="http://www.empireonline.com/images/uploaded/wreck-it-ralph-box-office.jpg";



    okHttpClient = new OkHttpClient();
    picasso = new Picasso.Builder(this)
            .downloader(new OkHttpDownloader(okHttpClient))
            .build();
    Context con = getApplicationContext();
    picasso.with(con)
            .load(image_url)
            .placeholder(R.drawable.ic_launcher)
            .resize(60,60)
            .into(imageview);
}

The app doesn't crash but it does not show the picture either! in the LogCat i've got these 2 errors:

09-15 13:17:17.419    2358-2358/**************** E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
09-15 13:17:17.439    2358-2358/**************** E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()

I'm using Genymotion 2.0.1 . Can u plz help me???


回答1:


I had a similar problem. I solved it by increasing the virtual machine's memory. Default setting in Genymotion is very small.

Open your VirtualBox Manager (NOT Genymotion). Select your desire Android VM and go to Settings / System and change the slider for Base Memory. You can also increase the Video Memory in the Display tab.




回答2:


Also try this

Genymotion > Settings > Misc > Clear Cache

this works for me




回答3:


I finally fixed the code by adding correct JAR Files! Please make sure that you have these libraries:

1- OKHTTP-2.0.0

2- OKHTTP-urlconnection-2.0.0 (not RC1 version!)

3- Okio-1.0.1

4- picasso-2.3.4

if you use these libraries, GradienCache Error will be handled as an exception and you'll no more get force close!



来源:https://stackoverflow.com/questions/25849392/e-openglrenderer-getting-max-texture-size-from-gradiencache-error-while-using-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!