问题描述
好吧,我决定同时试用适用于 Android 的 Volley 网络库和新的 Android Studio IDE.不过,我遇到了一些问题.
我构建了 volley.jar,将其复制到我的 libs 文件夹中以用于新项目,编辑 build.gradle 以包含 volley,并在我的主要活动中设置静态 ImageLoader 和 RequestQueue.但是,当我将应用程序加载到模拟器 (4.2) 上时,我最终得到了
E/AndroidRuntime:致命异常:主要java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley按如下方式调用 Volley 时:
queue = Volley.newRequestQueue(this);Gradle 编辑以支持库:
依赖{编译文件('libs/android-support-v4.jar')编译文件('libs/volley.jar')}有人介意给我指出正确的方向吗?
异常 java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker
在这里找到修复.
基本上,打开命令提示符(或终端)并导航到您的项目目录.在 Windows 上使用以下命令:
对于 Windows 用户:gradlew.bat 干净
对于 mac 用户输入:./gradlew clean
然后重新加载 Android Studio 并重试!
Well, I decided to try out the Volley networking library for Android and the new Android Studio IDE at the same time.. However, I'm running into some problems.
I built volley.jar, copied it into my libs folder for a new project, edited build.gradle to include volley, and setup a static ImageLoader and RequestQueue in my main activity. However, when I load the app onto an emulator (4.2), I end up getting
E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley
when invoking Volley as follows:
queue = Volley.newRequestQueue(this);
Gradle edits to support the library:
dependencies { compile files('libs/android-support-v4.jar') compile files('libs/volley.jar') }
Anyone mind pointing me in the right direction?
Exception java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker
Found the fix here.
Basically, open a command prompt (or terminal) and navigate to your project directory. Use the following command on Windows:
For Windows users:gradlew.bat clean
And for mac users type: ./gradlew clean
Then reload Android Studio and try again!
这篇关于Android Studio + Volley = NoClassDefFound?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!