Integrated Crashlytics Kit failed with Android project - android

First of all, using Eclipse. It creates 4 projects(as libraries) after plugin installed and creates kit-libs with those 4 projects in my android-project. Then I built the project and the apk compiled successfully but ran failed. Failed log:
12-22 17:50:07.377: E/dalvikvm(8452): Could not find class 'io.fabric.sdk.android.Kit[]', referenced from method com.pplive.test.fabric.MainActivity.onCreate
12-22 17:50:07.377: W/dalvikvm(8452): VFY: unable to resolve new-array 650 ([Lio/fabric/sdk/android/Kit;) in Lcom/pplive/test/fabric/MainActivity;
12-22 17:50:07.377: D/dalvikvm(8452): VFY: replacing opcode 0x23 at 0x0004
12-22 17:50:07.377: D/dalvikvm(8452): DexOpt: unable to opt direct call 0x0ff0 at 0x09 in Lcom/pplive/test/fabric/MainActivity;.onCreate
12-22 17:50:07.383: D/AndroidRuntime(8452): Shutting down VM
12-22 17:50:07.383: W/dalvikvm(8452): threadid=1: thread exiting with uncaught exception (group=0x41be8930)
12-22 17:50:07.386: E/AndroidRuntime(8452): FATAL EXCEPTION: main
12-22 17:50:07.386: E/AndroidRuntime(8452): java.lang.NoClassDefFoundError: io.fabric.sdk.android.Kit[]
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.pplive.test.fabric.MainActivity.onCreate(MainActivity.java:15)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.Activity.performCreate(Activity.java:5206)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.lbe.security.service.core.client.internal.InstrumentationDelegate.callActivityOnCreate(InstrumentationDelegate.java:76)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.access$600(ActivityThread.java:142)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1235)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.os.Looper.loop(Looper.java:137)
12-22 17:50:07.386: E/AndroidRuntime(8452): at android.app.ActivityThread.main(ActivityThread.java:5072)
12-22 17:50:07.386: E/AndroidRuntime(8452): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 17:50:07.386: E/AndroidRuntime(8452): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:812)
12-22 17:50:07.386: E/AndroidRuntime(8452): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
12-22 17:50:07.386: E/AndroidRuntime(8452): at dalvik.system.NativeStart.main(Native Method)
Do I need to modify the build path in property?

I found same issue couple of days ago, Yesterday I have resolved this issue by:
By compile my project using 1.7. As crashlytics compiled in 1.7
Installing build-tool 20 from sdk manager.
Hopes it worked for you too.

Related

On loading screen if orientation change then app crashes

I am facing some issue in login screen of my app, My app supports both orientation Portrait as well as landscape, in every condition it works good but when I click on Sign in button and on loading screen I change the orientation then app crashes...
I don't know where is the problem
here is error
12-22 14:29:51.559 W/Xamarin.Insights(11215): java.lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.Dialog.dismissDialog(Dialog.java:323)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.Dialog.dismiss(Dialog.java:306)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at mono.java.lang.RunnableImplementor.n_run(Native Method)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Handler.handleCallback(Handler.java:730)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Handler.dispatchMessage(Handler.java:92)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.os.Looper.loop(Looper.java:137)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at java.lang.reflect.Method.invoke(Method.java:525)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 14:29:51.559 W/Xamarin.Insights(11215): at dalvik.system.NativeStart.main(Native Method)
12-22 14:29:51.656 D/dalvikvm(11215): GC_CONCURRENT freed 536K, 41% free 4454K/7484K, paused 2ms+2ms, total 52ms
An unhandled exception occured.
12-22 14:29:53.584 E/mono-rt (11215): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:53.584 E/mono-rt (11215): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2098/3efa14c4/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
12-22 14:29:53.584 E/mono-rt (11215): at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod) [0x00062] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:554
12-22 14:29:53.584 E/mono-rt (11215): at Android.App.Dialog.Dismiss () [0x00043] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Dialog.cs:572
12-22 14:29:53.584 E/mono-rt (11215): at AndroidHUD.AndHUD+<DismissCurrent>c__AnonStorey4.<>m__0 () [0x0001c] in <filename unknown>:0
12-22 14:29:53.584 E/mono-rt (11215): at AndroidHUD.AndHUD+<DismissCurrent>c__AnonStorey4.<>m__1 (System.Object state) [0x00000] in <filename unknown>:0
12-22 14:29:53.584 E/mono-rt (11215): at Android.App.SyncContext+<Send>c__AnonStorey1.<>m__0 () [0x00000] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:32
12-22 14:29:53.584 E/mono-rt (11215): at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
12-22 14:29:53.584 E/mono-rt (11215): at Java.Lang.IRunnableInvoker.n_Run (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:71
12-22 14:29:53.584 E/mono-rt (11215): at (wrapper dynamic-method) System.Object:2491c231-85ea-488a-93d6-5c9d0adcdbd9 (intptr,intptr)
12-22 14:29:53.584 E/mono-rt (11215): --- End of managed exception stack trace ---
12-22 14:29:53.584 E/mono-rt (11215): java.lang.IllegalArgumentException: View not attached to window manager
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:308)
12-22 14:29:53.584 E/mono-rt (11215): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.Dialog.dismissDialog(Dialog.java:323)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.Dialog.dismiss(Dialog.java:306)
12-22 14:29:53.584 E/mono-rt (11215): at mono.java.lang.RunnableImplementor.n_run(Native Method)
12-22 14:29:53.584 E/mono-rt (11215): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Handler.handleCallback(Handler.java:730)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Handler.dispatchMessage(Handler.java:92)
12-22 14:29:53.584 E/mono-rt (11215): at android.os.Looper.loop(Looper.java:137)
12-22 14:29:53.584 E/mono-rt (11215): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-22 14:29:53.584 E/mono-rt (11215): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:29:53.584 E/mono-rt (11215): at java.lang.reflect.Method.invoke(Method.java:525)
12-22 14:29:53.584 E/mono-rt (11215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-22 14:29:53.584 E/mono-rt (11215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 14:29:53.584 E/mono-rt (11215): at dalvik.system.NativeStart.main(Native Method)
12-22 14:29:53.584 E/mono-rt (11215):
12-22 14:29:53.622 W/Mono (11215): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-22 14:29:53.640 D/Mono (11215): Unloading image System.Core.dll [0x728112e8].
12-22 14:29:53.642 D/Mono (11215): Image addref System.Core[0x7435b280] -> System.Core.dll[0x6f1ab1f0]: 8
12-22 14:29:53.650 W/Mono (11215): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-22 14:29:53.654 D/Mono (11215): Unloading image System.Core.dll [0x727f41e0].
12-22 14:29:53.656 D/Mono (11215): Image addref System.Core[0x7435b280] -> System.Core.dll[0x6f1ab1f0]: 9
In mgmain JNI_OnLoad
Thank you
Use these code in the your Manifest.xml file (in your activity class) then the data will not change in the both modes (landscape or portrait).
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode
OR USE SIMPLY THESE
android:configChanges="orientation|screenSize|screenLayout"
java.lang.IllegalArgumentException: View not attached to window manager
Means your Progress dialog not dismissed completly. So you need to check whether its null or not and showing or not. Also put it with try....catch statement.
try {
if ((myDialog!= null) && myDialog.isShowing()) {
myDialog.dismiss();
}
} catch (final IllegalArgumentException e) {
// Handle or log or ignore
} catch (final Exception e) {
// Handle or log or ignore
} finally {
myDialog = null;
}

Runtime linking error with SDL_Mixer and SMPEG2 on Android

I managed to fix the previous linking problem I had with NDK which was caused by android api 21, and managed to get SDL_TTF built and working easily, but with SDL_Mixer I bumped into another runtime Unsatisfiedlinkererror where the app somehow can't link smpeg2 lib with SDL2_Mixer. This time I don't see how it could have anything to do with api-level and have tried everything I could come up with, gone through every makefile and triple-checked every version.
I am using SDL_Mixer 2.0.0 and smpeg2-2.0.0 as its only dependecy. Smpeg2 is located in jni/ folder and the whole thing is built without compiler coughing.
I downloaded SDL_Mixer 2.0.0 source and put it in jni/ folder, copied smpeg2-2.0.0 from it's external/ folder to jni/ and set from mixer makefile to build only smpeg2. I edited src/Android.mk to see the mixer source and get the shared lib and then edited SDLActivity to pull SDL2_mixer library. SDL_TTF worked this way.
libsmpeg2.so DOES exist in libs/ folder so I don't see how it can't find it.
I am using android-19 as build target for NDK, no warnings or errors are given by the compiler.
01-22 18:17:43.760: D/dalvikvm(22101): Trying to load lib /data/data/com.kebabkeisari.peli/lib/libSDL2.so 0x41d88e78
01-22 18:17:43.760: D/dalvikvm(22101): Added shared lib /data/data/com.kebabkeisari.peli/lib/libSDL2.so 0x41d88e78
01-22 18:17:43.760: D/dalvikvm(22101): Trying to load lib /data/data/com.kebabkeisari.peli/lib/libSDL2_mixer.so 0x41d88e78
01-22 18:17:43.765: W/dalvikvm(22101): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/libsdl/app/SDLActivity;
01-22 18:17:43.765: W/dalvikvm(22101): Class init failed in newInstance call (Lcom/kebabkeisari/peli/Ribale;)
01-22 18:17:43.765: D/AndroidRuntime(22101): Shutting down VM
01-22 18:17:43.765: W/dalvikvm(22101): threadid=1: thread exiting with uncaught exception (group=0x410c52a0)
01-22 18:17:43.765: E/AndroidRuntime(22101): FATAL EXCEPTION: main
01-22 18:17:43.765: E/AndroidRuntime(22101): java.lang.ExceptionInInitializerError
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Class.newInstanceImpl(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Class.newInstance(Class.java:1319)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.os.Handler.dispatchMessage(Handler.java:99)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.os.Looper.loop(Looper.java:137)
01-22 18:17:43.765: E/AndroidRuntime(22101): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.reflect.Method.invokeNative(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.reflect.Method.invoke(Method.java:511)
01-22 18:17:43.765: E/AndroidRuntime(22101): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-22 18:17:43.765: E/AndroidRuntime(22101): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-22 18:17:43.765: E/AndroidRuntime(22101): at dalvik.system.NativeStart.main(Native Method)
01-22 18:17:43.765: E/AndroidRuntime(22101): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1892]: 1952 could not load needed library 'libsmpeg2.so' for 'libSDL2_mixer.so' (load_library[1094]: Library 'libsmpeg2.so' not found)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.Runtime.loadLibrary(Runtime.java:370)
01-22 18:17:43.765: E/AndroidRuntime(22101): at java.lang.System.loadLibrary(System.java:535)
01-22 18:17:43.765: E/AndroidRuntime(22101): at org.libsdl.app.SDLActivity.<clinit>(SDLActivity.java:51)
01-22 18:17:43.765: E/AndroidRuntime(22101): ... 15 more
You need to load the libraries in reverse dependency order. That is, if libSDL2_mixer.so depends on libsmpeg2.so, you first need to load libsmpeg2.so before you can try to load libSDL2_mixer.so.
That is, in order to load the library, you need to do this:
System.loadLibrary("smpeg2");
System.loadLibrary("SDL2_mixer");
IIRC this has been fixed in some very recent version of Android, but in order to have things working on older versions, you need to explicitly load them one at a time.

Can't change button text on launching android swipe view app

I'm using eclipse and making an android app
I'm trying to have a saved setting for a button but when I try to set the button text when the app starts up it fails and i get lots of errors.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create the adapter that will return a fragment for each of the three
// primary sections of the app.
mSectionsPagerAdapter = new SectionsPagerAdapter(
getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
LoadPreferences();
.........
}private void LoadPreferences(){
SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
floz = sharedPreferences.getBoolean("floz", false);
Button button = (Button) findViewById(R.id.buttonVolumeType);
button.setText("mls");
}
if I delete the button.setText("mls"); line it works fine
this is the logcat message
12-22 23:35:38.064: E/Trace(1384): error opening trace file: No such file or directory (2) 12-22 23:35:38.663: D/AndroidRuntime(1384): Shutting down VM
12-22 23:35:38.663: W/dalvikvm(1384): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
12-22 23:35:38.684: E/AndroidRuntime(1384): FATAL EXCEPTION: main
12-22 23:35:38.684: E/AndroidRuntime(1384): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cheapchug/com.example.cheapchug.MainActivity}: java.lang.NullPointerException
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.os.Looper.loop(Looper.java:137)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-22 23:35:38.684: E/AndroidRuntime(1384): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 23:35:38.684: E/AndroidRuntime(1384): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 23:35:38.684: E/AndroidRuntime(1384): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-22 23:35:38.684: E/AndroidRuntime(1384): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 23:35:38.684: E/AndroidRuntime(1384): at dalvik.system.NativeStart.main(Native Method)
12-22 23:35:38.684: E/AndroidRuntime(1384): Caused by: java.lang.NullPointerException
12-22 23:35:38.684: E/AndroidRuntime(1384): at com.example.cheapchug.MainActivity.LoadPreferences(MainActivity.java:260)
12-22 23:35:38.684: E/AndroidRuntime(1384): at com.example.cheapchug.MainActivity.onCreate(MainActivity.java:70)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.Activity.performCreate(Activity.java:5008)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-22 23:35:38.684: E/AndroidRuntime(1384): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
12-22 23:35:38.684: E/AndroidRuntime(1384): ... 11 more
in the onCreate Method the line setContentView(R.layout.main); loads only main.xml so the button hasn't been loaded yet and the button text can't be changed.
but by the time onCreateOptionsMenu(Menu menu) gets run the tab.xml files for the swiping view are loaded.

Android - ClassNotFoundException after refactoring

I've recently refactored class, package and folder names in my app (it's currently called MyApp) using Eclipse's refactor command, and I'm not getting a ClassNotFoundException. I've made sure there are no more instances of the old name anywhere in the code base. I've also deleted all the class files in \bin\classes and generated Java files in \gen (both of which have regenerated, I've checked). I've also updated the API level from 16 to 17 in an attempt to solve the problem. Here is the stack trace:
12-22 17:00:46.690: E/AndroidRuntime(25466): FATAL EXCEPTION: main
12-22 17:00:46.690: E/AndroidRuntime(25466): java.lang.RuntimeException: Unable to instantiate application com.myapp.MyApp: java.lang.ClassNotFoundException: Didn't find class "com.myapp.MyApp" on path: /data/app/com.myapp-2.apk
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.ActivityThread.access$1300(ActivityThread.java:141)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.os.Looper.loop(Looper.java:137)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-22 17:00:46.690: E/AndroidRuntime(25466): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 17:00:46.690: E/AndroidRuntime(25466): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 17:00:46.690: E/AndroidRuntime(25466): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-22 17:00:46.690: E/AndroidRuntime(25466): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-22 17:00:46.690: E/AndroidRuntime(25466): at dalvik.system.NativeStart.main(Native Method)
12-22 17:00:46.690: E/AndroidRuntime(25466): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.MyApp" on path: /data/app/com.myapp-2.apk
12-22 17:00:46.690: E/AndroidRuntime(25466): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
12-22 17:00:46.690: E/AndroidRuntime(25466): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-22 17:00:46.690: E/AndroidRuntime(25466): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.Instrumentation.newApplication(Instrumentation.java:968)
12-22 17:00:46.690: E/AndroidRuntime(25466): at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
12-22 17:00:46.690: E/AndroidRuntime(25466): ... 11 more
Here is my Manifest. I know hardcoding strings is bad style.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/ic_launcher"
android:name="MyApp"
android:label="MyApp"
android:theme="#style/NoActionBar">
<activity
android:name=".Otheractivity"
android:label="Otheractivity">
</activity>
<activity
android:name=".MainMenu"
android:label="MainMenu">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Any ideas on what the problem could be?
had the same problem, solved it by :
right click your project -> Java build path -> order and export(tab) -> make 'v' on "android private libraries"
tell me if it worked.
android:name="MyApp" in your Manifest means you need to have MyApp.java, declaring the class MyApp extending Application in your com.myapp package.
For those who still get this error in Android Studio, I resolved this by deleting .gradle folder from root directory -> clean and build -> run app again.
with the latest version of eclipse/ adt I get this sometimes when I have external libraries included. Removing them from the build path, and re-adding usually works to fix it.

IllegalStateException after coming back to a FragmentActivity

this is about a recurrent problem that I discovered my application is facing and is related to the use of a couple of DialogFragments. I'm targeting mainly platform level 8 devices so to use DialogFragments I had to use the compatibility library.
The problem itself happens whenever I get out of the application and them come back. Here's the stacktrace:
12-22 14:56:05.819: W/dalvikvm(6384): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
12-22 14:56:05.949: E/AndroidRuntime(6384): FATAL EXCEPTION: main
12-22 14:56:05.949: E/AndroidRuntime(6384): java.lang.IllegalStateException: Activity has been destroyed
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1269)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.BackStackRecord.commitAllowingStateLoss(BackStackRecord.java:529)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:102)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.view.ViewPager.populate(ViewPager.java:692)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:851)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.View.measure(View.java:8171)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.os.Looper.loop(Looper.java:123)
12-22 14:56:05.949: E/AndroidRuntime(6384): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 14:56:05.949: E/AndroidRuntime(6384): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:56:05.949: E/AndroidRuntime(6384): at java.lang.reflect.Method.invoke(Method.java:521)
12-22 14:56:05.949: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-22 14:56:05.949: E/AndroidRuntime(6384): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-22 14:56:05.949: E/AndroidRuntime(6384): at dalvik.system.NativeStart.main(Native Method)
And here's my stripped-down-to-the-minimum MainActivity.
public class MainActivity extends FragmentActivity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
...
public void showNewChannelFragmentDialog() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
NewChannelDialogFragment newFragment = NewChannelDialogFragment.newInstance();
newFragment.setContext(this);
newFragment.show(ft,"dialog");
}
}
The showNewChannelFragmentDialog() method is only called when the user selects a specific menu option, so I think the content of the DialogFragment itself is irrelevant here.
But you can see I do exactly what is shown here and it indeed works, the problem as I said earlier is whenever my application is being restored back to life once the user has left it.
Any suggestions? I'm considering dropping the fragments and just using regular Dialogs.
maybe it's not the one and only problem but you should call
ft.add(newFragment);
ft.commit(); //but at least this
at the end of your showNewChannelFragmentDialog() function.

Categories

Resources