android android-asynctask noclassdeffounderror

NoClassDefFoundError-Android 2.3.X



android-asynctask (5)

Esta es una clase interna. Consulta cómo acceder al objeto de la clase interna a través de la clase externa. De lo contrario, define tu clase My fuera del Mainclass.

Tengo una tarea definida en una clase. La excepción fatal "NoClassDefFoundError" está sucediendo en la siguiente línea

MyCuteTask myTask = new MyCuteTask(equations)

Aquí está el código

public class MyClass { public void run() { MyCuteTask myTask = new MyCuteTask(equations) } protected class MyCuteTask extends AsyncTask<String, Integer, String> { ... } }

Recientemente, tengo informes de errores extraños. Android lanza una excepción cuando instalo mi tarea. Tengo este error con Android 2.3.X solamente.

¿Alguno de ustedes tiene el mismo error?

EDITAR: Aquí está la pila Trace

java.lang.NoClassDefFoundError: com.mathssolver.main.k at com.mathssolver.main.Logic.updateGraph(Logic.java:310) at com.mathssolver.main.Graph.update(Graph.java:249) at com.mathssolver.main.MathGraphFragment.plotFunction(MathGraphFragment.java:236) at com.mathssolver.main.MathGraphFragment.plot(MathGraphFragment.java:158) at com.mathssolver.main.MathGraphFragment.showExample(MathGraphFragment.java:141) at com.mathssolver.main.MathGraphFragment.onStart(MathGraphFragment.java:109) at android.support.v4.app.Fragment.performStart(Fragment.java:1810) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:977) at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:842) at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1150) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1506) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) at android.support.v4.view.ViewPager.populate(ViewPager.java:1073) at android.support.v4.view.ViewPager.populate(ViewPager.java:919) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) at android.view.View.measure(View.java:8323) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewRoot.performTraversals(ViewRoot.java:842) at android.view.ViewRoot.handleMessage(ViewRoot.java:1862) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3806) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(NativeStart.java) Caused by: java.lang.ClassNotFoundException: com.mathssolver.main.k in loader dalvik.system.PathClassLoader[/data/app/com.shakti.mathssolver-1.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) at java.lang.ClassLoader.loadClass(ClassLoader.java:551) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at com.mathssolver.main.Logic.updateGraph(Logic.java:310) at com.mathssolver.main.Graph.update(Graph.java:249) at com.mathssolver.main.MathGraphFragment.plotFunction(MathGraphFragment.java:236) at com.mathssolver.main.MathGraphFragment.plot(MathGraphFragment.java:158) at com.mathssolver.main.MathGraphFragment.showExample(MathGraphFragment.java:141) at com.mathssolver.main.MathGraphFragment.onStart(MathGraphFragment.java:109) at android.support.v4.app.Fragment.performStart(Fragment.java:1810) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:977) at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:842) at android.support.v4.app.FragmentManagerImpl.startPendingDeferredFragments(FragmentManager.java:1150) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1506) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) at android.support.v4.view.ViewPager.populate(ViewPager.java:1073) at android.support.v4.view.ViewPager.populate(ViewPager.java:919) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) at android.view.View.measure(View.java:8323) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138) at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) at android.view.View.measure(View.java:8323) at android.view.ViewRoot.performTraversals(ViewRoot.java:842) at android.view.ViewRoot.handleMessage(ViewRoot.java:1862) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3806) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(NativeStart.java)

La línea en com.mathssolver.main.Logic.updateGraph (Logic.java:310) es

MyCuteTask myTask = new MyCuteTask(equations)


Asynctask se agregó en el nivel 3 de la API. Verifica uno marcando el mismo código con la API 3. Si desaparece, aparece tu problema


Tuve el mismo problema y copié el código fuente de AsyncTask como MyAsyncTask en mi proyecto y lo extendí desde esa clase, ahora funciona.


Es un problema de servicios de Google Play. ( https://code.google.com/p/android/issues/detail?id=81083 )

Solución alternativa para evitar este bloqueo hasta que Google lo solucione:

Agregue los siguientes datos a su método Application # onCreate ()

try { Class.forName("android.os.AsyncTask"); } catch(Throwable ignore) { // ignored }

Tenga en cuenta su Aplicación # onCreate () y no Activity # onCreate ()

Actualización: puedo verificar que los cambios anteriores arreglaron estos bloqueos para mí.