24942

Update External Jar in Android Project

Question:

All, I have an external JAR that I'm adding to my Android project. However, as my jar is consistently updating and changing. When I update my JAR, I get the dalvik VM magic number error.

I don't understand how I'm supposed to fix this?

Here's the steps I've followed.

<strong>Adding The Jar Initially</strong>

<ol><li>Copy JAR to libs folder in my project</li> <li>Run project</li> </ol>

My JAR is picked up, installed everyone is happy.

<strong>Updating the Jar</strong>

<ol><li>In Eclipse, go to the jar in libs and right click -> delete.</li> <li>Copy my new jar (same name) into the libs folder.</li> <li>Receive bad class file magic error.</li> </ol>

<strong>My Troubleshooting So Far</strong>

<ol><li>In eclipse, Project -> Clean...</li> <li>Select my project, clean it.</li> <li>Run it. Same error... magic number</li> <li>Project Properties -> Java Build Path -> Remove Android Private Libraries</li> </ol>

Now the private libraries aren't being re-added. (Which equates to missing imports in my Java project) Why is this a nightmare? Any suggestions?

Answer1:

Turns out that my issue was caused by the multiple JDK's I had. Android was defaulting to use JDK 1.7 while my console jar was using JDK 1.8

Recommend

  • From docker-compose to AWS
  • script/rails was not found, when running rails server (Rails 4)?
  • What are the difference between Cherry-pick and patch apply?
  • Rails 3 Link_to :remote is not triggering RJS
  • How does this compute ? I am trying to understand how the values of H get assigned in the list
  • SQL Server: preventing dirty reads in a stored procedure
  • How do I obtain a list of files that changed from svn over a date range?
  • integrate POCO library in android ndk
  • “mvn clean generate-source” could not resolve dependencies
  • In Java, how can I construct a File from a resource?
  • Android Studio Can't Find tools.jar
  • How to add a focus style to an editable ComboBox in WPF
  • Sequential (transactional) API calls in angular 4 with state management
  • Adjust width of select element according to selected option's width
  • Access Android Market through SSH tunnel
  • How do I superscript characters in a UIButton?
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Paperclip, set path outside of rails root folder
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • How to delete a row from a dynamic generate table using jquery?
  • Python: how to group similar lists together in a list of lists?
  • Proper folder structure for lots of source files
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • Trying to get generic when generic is not available
  • Getting Messege Twice Using IMvxMessenger
  • Change div Background jquery
  • How to get Windows thread pool to call class member function?
  • Bitwise OR returns boolean when one of operands is nil
  • Append folder name and increment by 1 using batch script
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?