引起:java.lang.NoClassDefFoundError:使用引导类加载器找不到类;没有堆栈可用

时间:2015-12-07 13:05:39

标签: java android eclipse google-play classnotfoundexception

我有android应用程序。当我在我的日食上运行或调试应用程序时,它可以顺利运行 没有错误没有警告。之后我得到了Google for Google play。当用户从谷歌游戏市场下载时,它们会出现以下错误。请帮帮我,我无法解决这个问题。它找不到一些课程。

这是从开发者控制台获取的错误;

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

这是我的清单;

<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>

9 个答案:

答案 0 :(得分:1)

我遇到了类似的问题

在我的情况下,由于即时运行而发生这种情况,只需禁用它

转到:

Android Studio - &gt;档案 - &gt;设置 - &gt;构建,执行,部署 - &gt;即时运行。

答案 1 :(得分:0)

请以正确的方式链接您的lib,您的库不会与您的应用程序一起编译,如果您使用的是第三方库,请确保在链接它们时将它们复制到项目中。链接库的屏幕截图可以提供更多帮助。

另外在旁注中,尝试在处理库时,比Eclipse更好地转移到Android Studio。

答案 2 :(得分:0)

它说 -

java.lang.ClassNotFoundException: Didn't find class "com.versus.hit.yeni.ACProgressFlower$Builder"

检查您正在调用的是否存在于同一路径上的bin文件夹中,如果不尝试再次添加与@ahmad said相同的库,或者清理项目并再次运行。 NoClassDefFoundError表示类加载器无法找到您尝试使用的类的.class文件。

答案 3 :(得分:0)

我通过改变

解决了我的问题
classpath 'com.android.tools.build:gradle:2.0.0-beta2'

classpath 'com.android.tools.build:gradle:1.3.0'

在build.gradle文件中。我不知道为什么这解决了这个问题。这可能是测试版中的错误。

答案 4 :(得分:0)

  1. 卸载应用

  2. 重新启动手机

  3. 重新安装应用

答案 5 :(得分:0)

从Project文件夹中删除临时 .gradle 文件夹。

答案 6 :(得分:0)

在我的情况下,它发生是因为我移动了项目位置。 我删除了&#34; .gradle&#34;包主模块,然后解决问题。

答案 7 :(得分:0)

如果你不对你的项目做任何事情,但抓住这个问题,你可以试试。 Android对我来说是新手,所以当我遇到这个问题时,我会清除所有自动生成的文件,包括{studio}的.gradle.build等。有用!享受你的编码!

答案 8 :(得分:0)

您似乎在发布buildTypes的gradle文件中有minifyEnabled true,在调试中有minifyEnabled false

如果是这样,请尝试添加您的 proguard-rules.pro 文件:

  1. -keep class com.versus.hit.yeni.ACProgressFlower$Builder
  2. -keep class com.versus.hit.yeni.JSONParser