[英]Android Studio fail add libs Universal Image Loader
Android-Universal-Image-Loader( https://github.com/nostra13/Android-Universal-Image-Loader ) is my favorite library. Android-Universal-Image-Loader( https://github.com/nostra13/Android-Universal-Image-Loader )是我最喜欢的库。
But it can't add libs when i use Android Studio(use 0.1.5 version). 但是当我使用Android Studio(使用0.1.5版本)时它无法添加库。
i know how to add libs in Android Studio ( https://stackoverflow.com/a/16628496/397457 ) 我知道如何在Android Studio中添加库( https://stackoverflow.com/a/16628496/397457 )
when i add Android-Universal-Image-Loader libs to Android Studio. 当我将Android-Universal-Image-Loader库添加到Android Studio时。 Editor error about "can't reslove R".
关于“无法重新获得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)
我尝试这个Max OSX(我尝试Windows但失败.Windows错误消息=>“Gradle:错误:包com.nostra13.universalimageloader.core不存在”。但编辑没有错误消息。仅在我运行应用程序时显示)
other libs like Gson no problem. 像Gson这样的其他libs没问题。 but only Android-Universal-Image-Loader have this problem.
但只有Android-Universal-Image-Loader才有这个问题。
Your Android Studio success add Android-Universal-Image-Loader? 您的Android Studio成功添加Android-Universal-Image-Loader? if success tell me how to.
如果成功告诉我如何。
I just added the universal-image-loader like this: 我刚刚添加了这样的通用图像加载器:
Firstly download the universal-image-loader-1.8.5-with-sources.jar. 首先下载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.) (2014年5月.universal-image-loader-1.9.2.jar效果很好。不需要“with-sources”文件。)
Then put it on my MyAppProject/MyApp/libs. 然后将它放在我的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. 右键单击universal-image-loader-1.8.5-with-sources.jar,我将其添加为具有默认配置的库。
Finally on MyAppProject/MyApp/build.gradle add the following: 最后在MyAppProject / MyApp / build.gradle上添加以下内容:
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. 从错误“ package com.nostra13.universalimageloader.core不存在 ”,似乎您没有将源添加为库。 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. 右键单击libs文件夹下的“universal-image-loader-1.8.4.jar”文件,然后从上下文菜单中单击
"Add as a library"
选项。
If after this you are getting the " ClassDefNotFoundException ", please follow the following steps: 如果在此之后您收到“ ClassDefNotFoundException ”,请按照以下步骤操作:
C:\\CarApplicationProject> gradlew clean
C:\\CarApplicationProject> gradlew clean
1.Put the jar (in my case, gson-2.2.4.jar) into the libs folder. 1.将jar(在我的例子中,gson-2.2.4.jar)放入libs文件夹中。
2.Ensure that compile files ('libs/gson-2.2.4.jar') is in your build.gradle file. 2.确保编译文件('libs / gson-2.2.4.jar')在build.gradle文件中。
3.Now Click on the "Sync Project with Gradle files"(Left to AVD manager Button on the topbar). 3.现在单击“使用Gradle文件同步项目”(左侧是顶部栏上的AVD管理器按钮)。
After I did the above three, it started working fine. 在我完成上述三项工作后,它开始正常工作。
There are two ways to use Universal Image Loader
有两种方法可以使用Universal Image Loader
By downloading Ja
r and add it to lib
folder and 通过
downloading Ja
r并将其添加到lib
文件夹和
compile files('libs/universal-image-loader-1.9.5-with-sources.jar') 编译文件('libs / universal-image-loader-1.9.5-with-sources.jar')
Simply add gradle dependency
只需添加
gradle dependency
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 编译'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
And here is a quick tutorial link 这是一个快速教程链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.