title: Running Android app in Eclipse results in ClassNotFoundException
body: <p>I've created a Maven project with an Android archetype in Eclipse several months ago. Since then I have been able to build and deploy my app directly from Eclipse, and I also believed Maven install to be working (I usually got BUILD SUCCESS). However, I just realized a few days ago that this "success" doesn't mean much - I tried deploying the apk I got after building with Maven to my phone (via the terminal), and the app immediately crashed. I noticed that during the build, I get a bunch of "Dx bad class file magic (cafebabe) or version (0033.0000)" errors, so I figured there was some problem with the compiler - using 6 instead of 7 or vice versa.
  While trying a bunch of solutions I found online, I also updated my SDK tools, which then caused Eclipse to tell me that I had to update to version 23, as I was working with 22.6. However, I was unable to update the IDE, as I got "conflicting dependencies" error. In the meantime I also read all over the the new version had a lot of bugs, so I tried going back, but by now my tools folder was missing from the sdk folder, and nothing worked. This is also when I was no longer able to run the app from Eclipse - I could build it, but trying to run it on my phone resulted in the following error:</p>
  
  <pre><code>08-25 15:15:39.965: E/AndroidRuntime(23081): java.lang.RuntimeException: Unable
  to instantiate activity ComponentInfo{me.comocomo.nutrino/me.comocomo.nutrino.
  MainActivity}: java.lang.ClassNotFoundException: Didn't find class "me.comocomo.
  nutrino.MainActivity" on path: DexPathList[[zip file "/data/app/me.comocomo.
  nutrino-9.nativeLibraryDirectories=[/data/app-lib/me.comocomo.nutrino-9,
  /vendor/lib, /system/lib]]
  </code></pre>
  
  <p>At this point I gave up and downloaded a new version of Eclipse, more accurately the ADT Bundle. This didn't go entirely smoothly either, as I had some issues installing the SVN and Maven plugins. Therefore, I tried working with the Android Studio; this required me to export my original project as a Gradle project. I'm not sure the export-import process was entirely successful, but I decided to put it on hold and try to resolve the Eclipse issue again.</p>
  
  <p>Anyway, to make a long story so much longer, I am now at the point where I have a working Eclipse (sort of - it still hangs every other time when I try opening it, and then I have to delete the org.eclipse.e4.workbench plugin xml file), specifically the newer version I have downloaded. I can build my app in Eclipse (Maven install fails), but I can't run it. However, deploying the apk in the terminal works, and my app loads.</p>
  
  <p>What I'm trying to figure out now is:</p>
  
  <ol>
  <li>How can I get rid of the ClassNotFoundException when running the app in Eclipse? I'm thinking it has something to do with the classpath file, but a) this is just a hunch and b) I have no idea what exactly the problem is.</li>
  <li>How can I get the Maven install to work? At the moment, the build fails - I will attach the error at the end.</li>
  <li>Even when the Maven install succeeded before, I got the "Dx bad class file magic.." warnings, and these dependencies were skipped. What can I do in order to get these files to be built (these are server classes that were build using the 1.7 compiler, and as far as I know, they can't be build with 1.6)?</li>
  </ol>
  
  <p>This is the Maven error I am currently getting:</p>
  
  <pre><code>[ERROR] Failed to execute goal on project NutrinoAndroid: Could not resolve
  dependencies for project me.comocomo.nutrino:NutrinoAndroid:apk:alpha: Failed to
  collect dependencies for [com.google.android:android:jar:4.1.1.4 (provided),
  com.google.android.support:android-support-v4:jar:4 (compile),
  com.google.android.support:android-support-v7-appcompat:jar:4 (compile),
  android.support:compatibility-v7-appcompat:apklib:19.0.1 (compile),
  android.support:compatibility-v7-appcompat:jar:19.0.1 (compile),
  me.comocomo.nutrino:nutrino-api:jar:0.0.1-SNAPSHOT (compile),
  com.octo.android.robospice:robospice-google-http-client:jar:1.4.12 (compile),
  com.octo.android.robospice:robospice:jar:1.4.12 (compile),
  commons-logging:commons-logging:jar:1.1.1 (provided),
  com.google.http-client:google-http-client-jackson2:jar:1.18.0-rc (compile),
  joda-time:joda-time:jar:2.3 (compile), org.quartz-scheduler:quartz:jar:2.2.1
  (compile), org.quartz-scheduler:quartz-jobs:jar:2.2.1 (compile)]: Failed to read
  artifact descriptor for java-activation-framework:jaf:jar:1.1.1: Could not
  transfer artifact java-activation-framework:jaf:pom:1.1.1 from/to central
  (http://repo.maven.apache.org/maven2): java.io.IOException: Remotely Closed [id:
  0x33cfa965, /10.100.101.106:65051 :&gt; repo.maven.apache.org/23.235.43.215:80] -&gt;
  [Help 1]
  </code></pre>
  
  <p>I don't want to just pile all of my code and configuration files here, so if there's anything more required - let me know and I'll add it.</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit</strong></p>
  
  <p>My manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="me.comocomo.nutrino"
  android:versionCode="10"
  android:versionName="alpha" &gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;uses-sdk
      android:minSdkVersion="14"
      android:targetSdkVersion="19" /&gt;
  &lt;!-- android:minSdkVersion="11" --&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@drawable/planbtn"
      android:label="@string/app_name"
      android:theme="@style/Theme.AppCompat.Light" &gt;
      &lt;service
          android:name="com.octo.android.robospice.JacksonGoogleHttpClientSpiceService"
          android:exported="false" /&gt;
  
      &lt;activity
          android:name="me.comocomo.nutrino.MainActivity"
          android:label="@string/app_name"
          android:screenOrientation="portrait" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Login.LoginActivity"
          android:label="@string/title_activity_login"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.GoalsSignupActivity"
          android:label="@string/title_activity_goals_signup"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Login.SignUp.EmailSignUpActivity"
          android:label="@string/title_activity_email_sign_up"
          android:screenOrientation="portrait"
          android:theme="@style/Theme.AppCompat.Translucent"
          android:windowSoftInputMode="stateVisible" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.GoalInfoActivity"
          android:label="@string/title_activity_goal_info"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.GoalsTargetWeightFragment"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.GoalsDevicesAppsConnectFragment"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.GoalsPhysiqueLifestyleActivity"
          android:label="@string/title_activity_goals_physique_lifestyle"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.ActivityLevelActivity"
          android:label="@string/title_activity_activity_level"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.ReduceFatActivity"
          android:label="@string/title_activity_reduce_fat"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.NonFood.LogDrinkActivity"
          android:label="@string/title_activity_log_water"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.NonFood.LogSleepActivity"
          android:label="@string/title_activity_log_sleep"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.NonFood.LogMeasurementsActivity"
          android:label="@string/title_activity_log_measurements"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.NonFood.LogFeelingActivity"
          android:label="@string/title_activity_log_measurements"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.Util.SelectMealsActivity"
          android:label="@string/title_activity_select_meals"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DiaryItemTypes.Util.RateNutrinoActivity"
          android:label="@string/title_activity_rate_nutrino"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DishBreakdownActivity"
          android:label="@string/title_activity_meal_breakdown"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Goals.BasicDetailsActivity"
          android:label="@string/title_activity_basic_details"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.ChooseAlternativeActivity"
          android:label="@string/title_activity_choose_alternative"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.RecipeActivity"
          android:label="@string/title_activity_recipe"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.RateDishActivity"
          android:label="@string/title_activity_rate_dish"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.MealBreakdownActivity"
          android:label="@string/title_activity_meal_breakdown"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.DailyBreakdownActivity"
          android:label="@string/title_activity_daily_breakdown"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.MyProfileActivity"
          android:label="@string/title_activity_my_profile"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.ConnectionProblemActivity"
          android:label="@string/title_activity_connection_problem"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.BodyActivity"
          android:label="@string/title_activity_body"
          android:screenOrientation="portrait" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.FoodAllergiesActivity"
          android:label="@string/title_activity_food_allergies" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.ConnectActivity"
          android:label="@string/title_activity_connect" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.SettingsActivity"
          android:label="@string/title_activity_settings" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Profile.SetProfileActivity"
          android:label="@string/title_activity_set_profile" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.TasteActivity"
          android:label="@string/title_activity_taste" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.EditGoalsActivity"
          android:label="@string/title_activity_edit_goals" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="me.comocomo.nutrino.Diary.PinMealActivity"
          android:label="@string/title_activity_pin_meal" &gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>And my pom:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p>http://maven.apache.org/maven-v4_0_0.xsd">
      4.0.0
      me.comocomo.nutrino
      NutrinoAndroid
      alpha
      apk
      NutrinoAndroid</p>
  
  <pre><code>&lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;platform.version&gt; 4.1.1.4
      &lt;/platform.version&gt;
      &lt;android.plugin.version&gt;3.5.3&lt;/android.plugin.version&gt;
      &lt;src.dir&gt;src&lt;/src.dir&gt;
  &lt;/properties&gt;
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;snapshot-repository.java.net&lt;/id&gt;
          &lt;name&gt;Java.net Snapshot Repository for Maven&lt;/name&gt;
          &lt;url&gt;https://maven.java.net/content/repositories/snapshots/&lt;/url&gt;
          &lt;layout&gt;default&lt;/layout&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android&lt;/groupId&gt;
          &lt;artifactId&gt;android&lt;/artifactId&gt;
          &lt;version&gt;${platform.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android.support&lt;/groupId&gt;
          &lt;artifactId&gt;android-support-v4&lt;/artifactId&gt;
          &lt;version&gt;4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android.support&lt;/groupId&gt;
          &lt;artifactId&gt;android-support-v7-appcompat&lt;/artifactId&gt;
          &lt;version&gt;4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;android.support&lt;/groupId&gt;
          &lt;artifactId&gt;compatibility-v7-appcompat&lt;/artifactId&gt;
          &lt;version&gt;19.0.1&lt;/version&gt;
          &lt;type&gt;apklib&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;android.support&lt;/groupId&gt;
          &lt;artifactId&gt;compatibility-v7-appcompat&lt;/artifactId&gt;
          &lt;version&gt;19.0.1&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;me.comocomo.nutrino&lt;/groupId&gt;
          &lt;artifactId&gt;nutrino-api&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;activation&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.activation&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt; &lt;artifactId&gt;jersey-client&lt;/artifactId&gt; 
          &lt;version&gt;2.7&lt;/version&gt; &lt;/dependency&gt; --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.octo.android.robospice&lt;/groupId&gt;
          &lt;artifactId&gt;robospice-google-http-client&lt;/artifactId&gt;
          &lt;version&gt;1.4.12&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.octo.android.robospice&lt;/groupId&gt;
          &lt;artifactId&gt;robospice&lt;/artifactId&gt;
          &lt;version&gt;1.4.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-logging&lt;/groupId&gt;
          &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.http-client&lt;/groupId&gt;
          &lt;artifactId&gt;google-http-client-jackson2&lt;/artifactId&gt;
          &lt;version&gt;1.18.0-rc&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;joda-time&lt;/groupId&gt;
          &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
          &lt;version&gt;2.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.quartz-scheduler&lt;/groupId&gt;
          &lt;artifactId&gt;quartz&lt;/artifactId&gt;
          &lt;version&gt;2.2.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.quartz-scheduler&lt;/groupId&gt;
          &lt;artifactId&gt;quartz-jobs&lt;/artifactId&gt;
          &lt;version&gt;2.2.1&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;sourceDirectory&gt;${src.dir}&lt;/sourceDirectory&gt;
      &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
      &lt;pluginManagement&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
                  &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${android.plugin.version}&lt;/version&gt;
                  &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
              &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;sdk&gt;
                      &lt;platform&gt;16&lt;/platform&gt;
                  &lt;/sdk&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>