如何在android studio中添加picasso库

Kar*_*iki 20 android android-studio picasso

我收到此错误,请帮帮我.

     Error:A problem occurred configuring project ':app'.
> Cannot evaluate module picasso-master : Configuration with name 'default' not found.
Run Code Online (Sandbox Code Playgroud)

到目前为止:

1. download the picaso 

2.unzip the zip folder

 3.Under project section created  one directory called as lib and add the unzip file

4. In settings-gradle

    include ':app'
include ':libs:picasso-master'

   wrote these lines.

5. after that in project structure module dependency  add the picasso library


6. rebuild and clean
Run Code Online (Sandbox Code Playgroud)

7.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(':library:picasso-master')
    compile 'com.squareup.picasso:picasso:2.5.0'
}
Run Code Online (Sandbox Code Playgroud)

我也在构建gradle文件中添加这些行.但同样的错误来了.我现在该怎么办 请帮我.

你能告诉我如何添加毕加索图书馆吗?

ojo*_*ifu 46

将此添加到您的依赖项中build.gradle:

在此输入图像描述

dependencies {
 implementation 'com.squareup.picasso:picasso:2.71828'
  ...
Run Code Online (Sandbox Code Playgroud)

或这个:

dependencies {
 implementation 'com.squareup.picasso:picasso:2.71828'
  ...
Run Code Online (Sandbox Code Playgroud)

最新版本可以在这里找到

确保已连接到Internet.同步gradle时,所有相关文件都将添加到项目中

看看你的库文件夹,你刚刚添加的库应该在那里.

在此输入图像描述


vuh*_*990 22

最简单的方法来增加依赖性

希望这有助于你或Ctrl+ Alt+ Shift+ S=>选择依赖选项卡并找到你需要的东西(见我的图片)

  • 加上1为gif视频 (2认同)

Man*_*ddy 6

在Dependency中添加picasso库

dependencies {
       ...
       implementation 'com.squareup.picasso:picasso:2.71828'
       ...
    }
Run Code Online (Sandbox Code Playgroud)

同步项目在布局中创建一个图像视图

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true">
</ImageView>
Run Code Online (Sandbox Code Playgroud)

在Manifest文件中添加Internet权限

<uses-permission android:name="android.permission.INTERNET" />
Run Code Online (Sandbox Code Playgroud)

//初始化ImageView

ImageView imageView = (ImageView) findViewById(R.id.imageView);
Run Code Online (Sandbox Code Playgroud)

//将图片从url下方加载到imageView中

Picasso.get()
   .load("YOUR IMAGE URL HERE")
   .into(imageView);
Run Code Online (Sandbox Code Playgroud)