为什么毕加索无法加载我的 url?始终默认为 onError。

Why can't picasso load my url? Always defaulting to onError.

这是将使用 picasso 的 myActivity 的 onCreate:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String url = "http://s3.amazonaws.com/snappie.watermarks/crssd.png";
        sticker = (ImageView)findViewById(R.id.sticker);
        Picasso.with(getApplicationContext()).setLoggingEnabled(true);

        FrameLayout camera_layout =(FrameLayout)findViewById(R.id.fragment_container);
        previewWidth = camera_layout.getWidth();
        Log.d("width","width is"+previewWidth);
        Picasso.with(this).load(url).into(sticker,new Callback() {
            @Override
            public void onSuccess() {
                myBitmap = ((BitmapDrawable) sticker.getDrawable()).getBitmap();
                int width = (myBitmap.getWidth() * previewWidth) / 1080;
                int height = (myBitmap.getHeight() * previewWidth) / 1080;
                scaledBitmap = Bitmap.createScaledBitmap(myBitmap, width, height, false);
                sticker.setImageBitmap(scaledBitmap);
                //saveBitmap(myBitmap);
            }

            @Override
            public void onError() {
                Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.balloons);
                sticker.setImageBitmap(bm);
            }
        });

    }

它几乎总是默认为气球(来自 onError)。

这是日志:

05-31 12:04:22.705    6610-6610/com.snappiesticker.cwac4 D/Picasso﹕ Main        created      [R0] Request{http://s3.amazonaws.com/snappie.watermarks/crssd.png}
05-31 12:04:22.709    6610-6629/com.snappiesticker.cwac4 D/Picasso﹕ Dispatcher  enqueued     [R0]+4ms
05-31 12:04:22.714    6610-6631/com.snappiesticker.cwac4 D/Picasso﹕ Hunter      executing    [R0]+10ms
05-31 12:04:22.732    6610-6629/com.snappiesticker.cwac4 D/Picasso﹕ Dispatcher  batched      [R0]+28ms for error
05-31 12:04:22.815    6610-6653/com.snappiesticker.cwac4 D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-31 12:04:22.822    6610-6610/com.snappiesticker.cwac4 D/Atlas﹕ Validating map...
05-31 12:04:22.856    6610-6653/com.snappiesticker.cwac4 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/14/15, ab0075f, Id3510ff6dc
05-31 12:04:22.857    6610-6653/com.snappiesticker.cwac4 I/OpenGLRenderer﹕ Initialized EGL, version 1.4
05-31 12:04:22.879    6610-6653/com.snappiesticker.cwac4 D/OpenGLRenderer﹕ Enabling debug mode 0
05-31 12:04:22.966    6610-6629/com.snappiesticker.cwac4 D/Picasso﹕ Dispatcher  delivered    [R0]+261ms
05-31 12:04:22.977    6610-6610/com.snappiesticker.cwac4 D/Picasso﹕ Main        errored      [R0]+272ms

如果您手动尝试 url,您会发现它是真实存在的。那么这是怎么回事?

看起来不错,您可能错过了互联网使用许可。添加

<uses-permission android:name="android.permission.INTERNET" />

给你的AndroidManifest.xml