0

Long story cut short - I have an app that has been around for about 4 years now with a smallish user base (around 500 devices). It was originally developed on a Win XP machine but I then migrated over to a Debian Linux setup a year or so ago. No problems, all well and good.

A few months ago I updated to the latest Android SDK / ADT for Eclipse and everything went down the pan (the appcompat-v7 wouldn't build and can't be recognised).

In frustration, I've migrated back to the XP box and all seems well and good in that I no longer get critical errors and everything builds fine. The problem is when I deploy to my Nexus 7 for testing. It installs OK but on startup I immediately get "Unfortunately, nDroid (TE) has stopped".

Logcat shows the following. The class "uk.co.beetec.android.nDroidTE.NDroidTE" extends the Android Application class and is quite clearly there in my code without errors or warnings at build time and it is declared in the AndroidManifest.xml.

I really have no idea what is going wrong here. Can anyone explain that stacktrace because I don't understand what might be causing it.

03-23 11:16:25.194: E/AndroidRuntime(16878): FATAL EXCEPTION: main
03-23 11:16:25.194: E/AndroidRuntime(16878): Process: uk.co.beetec.android.nDroidTE, PID: 16878
03-23 11:16:25.194: E/AndroidRuntime(16878): java.lang.RuntimeException: Unable to instantiate application uk.co.beetec.android.nDroidTE.NDroidTE: java.lang.ClassNotFoundException: Didn't find class "uk.co.beetec.android.nDroidTE.NDroidTE" on path: DexPathList[[zip file "/data/app/uk.co.beetec.android.nDroidTE-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.ActivityThread.access$1500(ActivityThread.java:151)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.os.Handler.dispatchMessage(Handler.java:102)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.os.Looper.loop(Looper.java:135)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.ActivityThread.main(ActivityThread.java:5254)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at java.lang.reflect.Method.invoke(Native Method)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at java.lang.reflect.Method.invoke(Method.java:372)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
03-23 11:16:25.194: E/AndroidRuntime(16878): Caused by: java.lang.ClassNotFoundException: Didn't find class "uk.co.beetec.android.nDroidTE.NDroidTE" on path: DexPathList[[zip file "/data/app/uk.co.beetec.android.nDroidTE-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
03-23 11:16:25.194: E/AndroidRuntime(16878):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.Instrumentation.newApplication(Instrumentation.java:980)
03-23 11:16:25.194: E/AndroidRuntime(16878):    at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
03-23 11:16:25.194: E/AndroidRuntime(16878):    ... 10 more
03-23 11:16:25.194: E/AndroidRuntime(16878):    Suppressed: java.lang.NoClassDefFoundError: uk.co.beetec.android.nDroidTE.NDroidTE
03-23 11:16:25.194: E/AndroidRuntime(16878):        at dalvik.system.DexFile.defineClassNative(Native Method)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at dalvik.system.DexFile.defineClass(DexFile.java:226)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at dalvik.system.DexPathList.findClass(DexPathList.java:321)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
03-23 11:16:25.194: E/AndroidRuntime(16878):        ... 14 more
03-23 11:16:25.194: E/AndroidRuntime(16878):    Suppressed: java.lang.ClassNotFoundException: uk.co.beetec.android.nDroidTE.NDroidTE
03-23 11:16:25.194: E/AndroidRuntime(16878):        at java.lang.Class.classForName(Native Method)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-23 11:16:25.194: E/AndroidRuntime(16878):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-23 11:16:25.194: E/AndroidRuntime(16878):        ... 13 more
03-23 11:16:25.194: E/AndroidRuntime(16878):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Squonk
  • 48,735
  • 19
  • 103
  • 135
  • have you added `appcompat-v7` to build path? – hrskrs Mar 23 '15 at 12:06
  • uk.co.beetec.android.nDroidTE.NDroidTE: is this the exact path of your application class? –  Mar 23 '15 at 12:08
  • I guess you have already tried to clean and rebuild the project? – Henry Mar 23 '15 at 12:11
  • have you tried to migrate to Android Studio and Gradle build? Eclipse ADT is deprecated nowadays AFAIK – Droidman Mar 23 '15 at 12:15
  • @hrskrs : Yep, the Build Path looks absolutely fine and the build produces an APK of the size I'd expect (and it installs fine on my device). – Squonk Mar 23 '15 at 12:37
  • @jvrodrigues : Yes, that's exactly the exact path. – Squonk Mar 23 '15 at 12:38
  • @Henry : Cleaned and rebuilt several times over. – Squonk Mar 23 '15 at 12:38
  • @Droidman : I haven't tried Android Studio on my XP box but I did on my Linux box after the SDK/ADT screw-up and Android Studio displayed the same behaviour although that's unrelated to this issue. The Exclipse and Android SDK/ADT setup is the same as it was a year or so ago - perhaps the migration via Git has screwed something, I'm not sure. – Squonk Mar 23 '15 at 12:41

1 Answers1

2

I have observed this error previously in the following cases:

1. I was using a physical device (i.e. not an emulator) that had Kitkat with ART enabled. When I ran the app on another Kitkat device with Dalvik runtime, the error seemed to have vanished.

2. The same problem arose due to a .dex build error which occurred when I shifted the SVN to another location. I deleted the old project entirely and created a new repository from the original project on my computer, and after rebuilding the project entirely the error did not reappear.

3. If using Eclipse with Maven, and you have enabled multidex, then try disabling it and building the project. If using Android Studio, set multiDexEnabled = false. This is a known cause of this error.

Yash Sampat
  • 30,051
  • 12
  • 94
  • 120
  • @Squonk: so, any luck ? – Yash Sampat Mar 26 '15 at 14:08
  • Not conclusive so far but it looks like your 2nd point might be relevant. It seems the Build Path was a bit screwy after I pulled the code down to the XP machine from my Git repository. I still get a fatal error at start but I now see the MAIN/LAUNCHER `Activity` and starting the app a second time works fine. I'll probably accept your answer later after a couple more tests. – Squonk Mar 26 '15 at 15:05
  • @Squonk: so, any results ? – Yash Sampat Apr 15 '15 at 16:18
  • Sorry it took time, I've had a really busy few weeks. I did something similar to your point 2. I deleted the project from my Eclipse environment (but not delete the files on disk). I then cleaned up the various auto-generated project files and created a new project from the same code files. – Squonk Apr 15 '15 at 18:35
  • great ... I assume that worked. When will we get a VM and a compiler that does not lead to these odd errors – Yash Sampat Apr 15 '15 at 18:52