问题
I have android application. When I run or debug app on my eclipse it Works smoothly with no error no warnings.After then I get apk for Google play. Useres are getting below errors when they downloaded it from Google play market. Please help me I was not able to solve this problem. It can not find some classes.
This is errors which getting from developer console;
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/versus/hit/yeni/JSONParser;
at com.versus.hit.yeni.Signin$CheckUser.<init>(Signin.java:211)
at com.versus.hit.yeni.Signin$2.onClick(Signin.java:121)
at android.view.View.performClick(View.java:4785)
at android.view.View$PerformClick.run(View.java:19858)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.versus.hit.yeni.JSONParser" on path: DexPathList[[zip file "/data/app/com.versus.hit.yeni-1/base.apk"],nativeLibraryDirectories=[/system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 12 more
Suppressed: java.lang.ClassNotFoundException: com.versus.hit.yeni.JSONParser
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/versus/hit/yeni/JSONParser;
at com.versus.hit.yeni.Signup.parseJson(Signup.java:384)
at com.versus.hit.yeni.Signup.onCreateView(Signup.java:165)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.versus.hit.yeni.JSONParser" on path: DexPathList[[zip file "/data/app/com.versus.hit.yeni-1/base.apk"],nativeLibraryDirectories=[/system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.versus.hit.yeni.JSONParser
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/versus/hit/yeni/ACProgressFlower$Builder;
at com.versus.hit.yeni.Signin$CheckUser.onPreExecute(Signin.java:236)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
at android.os.AsyncTask.execute(AsyncTask.java:535)
at com.versus.hit.yeni.Signin$2.onClick(Signin.java:123)
at android.view.View.performClick(View.java:4785)
at android.view.View$PerformClick.run(View.java:19858)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.versus.hit.yeni.ACProgressFlower$Builder" on path: DexPathList[[zip file "/data/app/com.versus.hit.yeni-1/base.apk"],nativeLibraryDirectories=[/system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.versus.hit.yeni.ACProgressFlower$Builder
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
This is my manifest;
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.versus.hit.yeni"
android:versionCode="5"
android:versionName="1.2.2" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity android:name="com.versus.hit.yeni.SplashActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.versus.hit.yeni.MY_ACTION" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="versus" android:host="www.versushit.com" />
</intent-filter>
</activity>
<activity android:name="com.versus.hit.yeni.MainActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock.Light.DarkActionBar" >
</activity>
<activity android:name="com.versus.hit.yeni.SearchActivity"
android:theme="@style/ACPLDialog" >
</activity>
<activity android:name="com.versus.hit.yeni.PersonalPage"
android:windowSoftInputMode="adjustPan"
android:theme="@style/Theme.Sherlock.Light.DarkActionBar" >
</activity>
<activity android:name="com.versus.hit.yeni.FollowActivity"
android:theme="@style/ACPLDialog" >
</activity>
<activity
android:name="com.versus.hit.yeni.ReportActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.REPORT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.versus.hit.yeni.MailSender"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".FacebookLoginActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.facebook.LoginActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/appid" />
</application>
回答1:
I faced similar problem
In my case it is happening because of instant run, Just disable it
Goto :
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
回答2:
Please link your libs the correct way, your libraries are not compiled with your app, if you are using 3rd party libraries make sure you are copying them to the project when linking them. A screenshot of your linked libraries would help more.
Also on a side note, try to move to Android Studio its much better than Eclipse in handling libraries.
回答3:
it is saying -
java.lang.ClassNotFoundException: Didn't find class "com.versus.hit.yeni.ACProgressFlower$Builder"
check what you are calling is it exist in bin folder on the same path or not if not try to add again same library as @ahmad said
or clean the project and run again.
NoClassDefFoundError
indicates that the Class Loader cannot find the .class file for the class that you're trying to use.
回答4:
I solved mine by changing
classpath 'com.android.tools.build:gradle:2.0.0-beta2'
to
classpath 'com.android.tools.build:gradle:1.3.0'
in build.gradle file. I'm not sure why this solved the problem. This may be a bug in the beta version.
回答5:
Uninstall the app
restart your phone
reinstall the app
回答6:
Remove temporary .gradle folder from your Project folder.
回答7:
In my case it happens because I move the project location. I remove the ".gradle " package of main module, then solve the problem.
回答8:
If you don't do anything on your project, but catch this issue, this you can try. Android is new to me, so when I get this issue I clear all files which auto generated include .gradle
, .build
and etc by android studio. It works! enjoy your coding!
来源:https://stackoverflow.com/questions/34134312/caused-by-java-lang-noclassdeffounderror-class-not-found-using-the-boot-class