E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Gr

2019-01-28 18:29发布

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???

3条回答
ら.Afraid
2楼-- · 2019-01-28 19:09

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.

enter image description here

查看更多
Viruses.
3楼-- · 2019-01-28 19:09

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!

查看更多
放荡不羁爱自由
4楼-- · 2019-01-28 19:12

Also try this

Genymotion > Settings > Misc > Clear Cache

this works for me

查看更多
登录 后发表回答