Android Studio fail add libs Universal Image Loader

Android-Universal-Image-Loader(https://github.com/nostra13/Android-Universal-Image-Loader) is my favorite library.

But it can’t add libs when i use Android Studio(use 0.1.5 version).

  • Open source Android libraries? Reusable Views, ViewGroups, Adapters etc?
  • android service startService() and bindService()
  • Why does the android apk size differs when built from windows and mac
  • Relative Layout alignParentLeft vs alignParentStart
  • What is “android:allowBackup”?
  • how to get object from listview in setOnItemClickListener in android?
  • i know how to add libs in Android Studio
    (https://stackoverflow.com/a/16628496/397457)

    when i add Android-Universal-Image-Loader libs to Android Studio. Editor error about “can’t reslove R”. i try this Max OSX(i try too Windows but fail. Windows error message => “Gradle: error: package com.nostra13.universalimageloader.core does not exist”. but Editor no error message. only show when i run application)

    other libs like Gson no problem. but only Android-Universal-Image-Loader have this problem.

    Your Android Studio success add Android-Universal-Image-Loader? if success tell me how to.

    Related posts:

    C/C++ printfs - Where's it appears in a Android native code?
    Center CheckBox drawable within itself
    How can I get the bitmap of the canvas I get in onDraw?
    Running a specific unit test with gradle
    ListView with first visible item having different layout
    View reuse in fragments android
  • Android Webview shouldOverrideUrlLoading method
  • Android List view refresh
  • How to catch application uninstalling on device and let server know about this (iOS/Android)
  • NotificationCompat android - how to show only Large icon without small
  • How to run .APK file on emulator
  • How can i Link prebuilt shared Library to Android NDK project?
  • 4 Solutions collect form web for “Android Studio fail add libs Universal Image Loader”

    I just added the universal-image-loader like this:

    Firstly download the universal-image-loader-1.8.5-with-sources.jar.

    (For 5/2014. universal-image-loader-1.9.2.jar works great. Don’t need the “with-sources” file.)

    Then put it on my MyAppProject/MyApp/libs.

    Right clicking on universal-image-loader-1.8.5-with-sources.jar i add it as a library with the default configuration.

    Finally on MyAppProject/MyApp/build.gradle add the following:

    dependencies {
    compile files('libs/universal-image-loader-1.8.5-with-sources.jar')
    }
    

    From the error “package com.nostra13.universalimageloader.core does not exist“, it seems like you have not added the source as the library. Right click the “universal-image-loader-1.8.4.jar” file under the libs folder and from the context menu, click "Add as a library" option.

    If after this you are getting the “ClassDefNotFoundException“, please follow the following steps:

    1. Add the library to the project.
    2. Edit your Gradle build file and add the dependency for the UIL in it
      Add dependency in build.gradle
    3. Close Android Studio
    4. Open command prompt and go to the project’s root folder (you will find ‘gradlew’ file there) and clean your build by issuing the clean command C:\CarApplicationProject> gradlew clean
    5. Restart Android Studio.

    1.Put the jar (in my case, gson-2.2.4.jar) into the libs folder.

    2.Ensure that compile files (‘libs/gson-2.2.4.jar’) is in your build.gradle file.

    3.Now Click on the “Sync Project with Gradle files”(Left to AVD manager Button on the topbar).

    After I did the above three, it started working fine.

    There are two ways to use Universal Image Loader

    1. By downloading Jar and add it to lib folder and

      compile files(‘libs/universal-image-loader-1.9.5-with-sources.jar’)

    2. Simply add gradle dependency

      compile ‘com.nostra13.universalimageloader:universal-image-loader:1.9.5’

    And here is a quick tutorial link

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.