I have found an interesting case producing the java.lang.LinkageError exception.
In my base activity there is an isResumed field, I set it to true in onResume - and to false in onPause.
It's protected field.
Today I decided to add a method to get that value from a fragment, so I have added isResumed() method
public class BaseActoinBarActivity extends ActionBarActivity {
protected boolean isResumed;
@Override
protected void onResume() {
super.onResume();
isResumed = true;
...
}
...
public boolean isResumed() {
return isResumed;
}
...
}
public class StartActivity extends BaseActionBarActivity {
...
}
Ok, after I have started my application I have got an exception:
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.base.BaseActionBarActivity>
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.base.BaseActionBarActivity>
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.StartActivity>
05-07 18:45:21.021 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.StartActivity>
05-07 18:45:21.021 14466-14466/? D/AndroidRuntime﹕ Shutting down VM
05-07 18:45:21.274 14466-14466/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: ru.xxxxxx.ui, PID: 14466
java.lang.LinkageError: ru.simpls.mtsbank2.ui.StartActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at ru.simpls.mtsbank2.ui.SplashScreen$1.handleMessage(SplashScreen.java:42)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
It's really funny :)
(SplashScreen is a splash screen activity, it starts StartActivity)
In my base activity there is an isResumed field, I set it to true in onResume - and to false in onPause.
It's protected field.
Today I decided to add a method to get that value from a fragment, so I have added isResumed() method
public class BaseActoinBarActivity extends ActionBarActivity {
protected boolean isResumed;
@Override
protected void onResume() {
super.onResume();
isResumed = true;
...
}
...
public boolean isResumed() {
return isResumed;
}
...
}
public class StartActivity extends BaseActionBarActivity {
...
}
Ok, after I have started my application I have got an exception:
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.base.BaseActionBarActivity>
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.base.BaseActionBarActivity>
05-07 18:45:21.020 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.StartActivity>
05-07 18:45:21.021 14466-14466/? I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<ru.xxxxxx.ui.StartActivity>
05-07 18:45:21.021 14466-14466/? D/AndroidRuntime﹕ Shutting down VM
05-07 18:45:21.274 14466-14466/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: ru.xxxxxx.ui, PID: 14466
java.lang.LinkageError: ru.simpls.mtsbank2.ui.StartActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at ru.simpls.mtsbank2.ui.SplashScreen$1.handleMessage(SplashScreen.java:42)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
It's really funny :)
(SplashScreen is a splash screen activity, it starts StartActivity)