问题描述
我添加以下()我/ libs文件夹并也把它在模块设置图书馆和打勾导出按钮。在实际的文件中,有没有给出错误,它无法找到类,当我做进口com.loopj和问题等等它完成它为我和我展示了可用的选项。
I've added the following (http://loopj.com/android-async-http/) to my /libs folder and have also put it in the module settings as a library and ticked the export button. In the actual file there are no errors given that it can't find the class and when I do import com.loopj and so-forth it completes it for me and shows me the available options.
然而,当我我的手机上运行它,它提供了以下错误:
However, when I run it on my phone it gives the following errors:
12-02 23:00:08.943 8209-8209/mobi.vassilev.beam E/dalvikvm﹕ Could not find class 'com.loopj.android.http.AsyncHttpClient', referenced from method mobi.vassilev.beam.GoogleLoginActivity.requestAPIKeyFromOAuthToken
12-02 23:00:09.183 8209-8209/mobi.vassilev.beam E/﹕ file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
12-02 23:00:10.453 8382-8382/? E/ObjectHelper﹕ Can't find method:setCompatibilityInfo
12-02 23:00:10.598 8209-8209/mobi.vassilev.beam E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.loopj.android.http.AsyncHttpClient
at mobi.vassilev.beam.GoogleLoginActivity.requestAPIKeyFromOAuthToken(GoogleLoginActivity.java:118)
at mobi.vassilev.beam.GoogleLoginActivity.access$200(GoogleLoginActivity.java:24)
at mobi.vassilev.beam.GoogleLoginActivity$OnTokenAcquired.run(GoogleLoginActivity.java:105)
at android.accounts.AccountManager$11.run(AccountManager.java:1335)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:5751)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
at dalvik.system.NativeStart.main(Native Method)
12-02 23:00:10.633 513-548/? E/EmbeddedLogger﹕ App crashed! Process: mobi.vassilev.beam
和code的提取物(未完成OBV作为URL是假的,但应该不会影响任何东西):
and the extract of code (not complete obv as the URL is fake, but that shouldn't affect anything):
private void requestAPIKeyFromOAuthToken(String token) {
AsyncHttpClient client = new AsyncHttpClient(); // <-- this is line 118
RequestParams params = new RequestParams("token", token);
client.post("https://myrailsapp.com/api/v1/auth/verify", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
Log.w("OAUTH", "Got API key from server: " + response);
finish();
}
@Override
public void onFailure(Throwable e) {
Log.w("OAUTH", "Error getting API key");
Toast.makeText(getApplicationContext(), R.string.connection_error_message, Toast.LENGTH_LONG).show();
e.printStackTrace();
}
});
}
会有人知道解决这个问题呢?
Would anyone know a solution to this problem?
非常感谢你,
丹尼尔
Thank you very much,Daniel
推荐答案
在Android的工作室,你有你的jar添加到lib文件夹中添加依赖到的build.gradle文件并调用 gradlew清洁
从控制台。该gradlew是在你的项目目录。
In Android Studio, you have to add your jar into the lib folder, add the dependency into the build.gradle file and call gradlew clean
from console. The gradlew is in your project directory.
勾选此线程了解详情: Android的工作室:添加JAR作为库一>
Check this thread for more details: Android Studio: Add jar as library?
这篇关于(Android版)无级高清发现误差com.loopj.android.http.AsyncHttpClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!