I have created a very simple Android app just to work with functionality. Within the app I would like to call a web service client to retrieve and display some data. I think I have succesfully imported and referenced the jar file (i.e. library). It appears to be instantiating the class successfully but when that class is referencing another class within the jar/library it throws a class not found error. Any ideas??? Anything else I can provide to help answer???
Here is my code:
package mhcs.android.ehd;
import mhcs.services.client.EHD.EHDClient;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class GetTicketDescription extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
EHDClient client = new EHDClient();
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String title = getString(R.string.title);
setTitle(title); // done so that we can change the default title
//get handles to editText and button widgets
final EditText eText = (EditText) findViewById(R.id.editText1);
final Button button = (Button) findViewById(R.id.button1);
eText.setText(client.getTicketDescription("MMLZ-8LVRMK"));
button.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v) {
//get the String entered into the editText widget
CharSequence editText = eText.getText();
//display the toast
Toast.makeText(GetTicketDescription.this, editText, Toast.LENGTH_LONG).show();
}
});
}
}
Here is the error:
D/dalvikvm(538): Not late-enabling CheckJNI (already on)
I/dalvikvm(538): threadid=3: reacting to signal 3
I/dalvikvm(538): Wrote stack traces to '/data/anr/traces.txt'
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
E/dalvikvm(538): Could not find class 'org.tempuri.EHDLookupService', referenced from method mhcs.services.client.EHD.EHDClient.<init>
W/dalvikvm(538): VFY: unable to resolve new-instance 93 (Lorg/tempuri/EHDLookupService;) in Lmhcs/services/client/EHD/EHDClient;
D/dalvikvm(538): VFY: replacing opcode 0x22 at 0x0003
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
I/dalvikvm(538): Could not find method org.tempuri.EHDLookupService.getBasicHttpBindingIEHDLookupService, referenced from method mhcs.services.client.EHD.EHDClient.<init>
W/dalvikvm(538): VFY: unable to resolve virtual method 112: Lorg/tempuri/EHDLookupService;.getBasicHttpBindingIEHDLookupService ()Lorg/tempuri/IEHDLookupService;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x001c
W/dalvikvm(538): VFY: unable to find class referenced in signature (Ljavax/xml/bind/JAXBElement;)
I/dalvikvm(538): Could not find method javax.xml.bind.JAXBElement.getValue, referenced from method mhcs.services.client.EHD.EHDClient.getAssigneeTickets
W/dalvikvm(538): VFY: unable to resolve virtual method 42: Ljavax/xml/bind/JAXBElement;.getValue ()Ljava/lang/Object;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x0026
W/dalvikvm(538): VFY: unable to find class referenced in signature (Ljavax/xml/bind/JAXBElement;)
I/dalvikvm(538): Could not find method javax.xml.bind.JAXBElement.getValue, referenced from method mhcs.services.client.EHD.EHDClient.getTicketDescription
W/dalvikvm(538): VFY: unable to resolve virtual method 42: Ljavax/xml/bind/JAXBElement;.getValue ()Ljava/lang/Object;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x000b
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
D/dalvikvm(538): DexOpt: unable to opt direct call 0x006b at 0x15 in Lmhcs/services/client/EHD/EHDClient;.<init>
D/AndroidRuntime(538): Shutting down VM
W/dalvikvm(538): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
E/AndroidRuntime(538): FATAL EXCEPTION: main
E/AndroidRuntime(538): java.lang.NoClassDefFoundError: org.tempuri.EHDLookupService
E/AndroidRuntime(538): at mhcs.services.client.EHD.EHDClient.<init>(EHDClient.java:25)
E/AndroidRuntime(538): at mhcs.android.ehd.GetTicketDescription.onCreate(GetTicketDescription.java:15)
E/AndroidRuntime(538): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime(538): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime(538): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime(538): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime(538): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime(538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime(538): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(538): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(538): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(538): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(538): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(538): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(538): threadid=3: reacting to signal 3
I/dalvikvm(538): Wrote stack traces to '/data/anr/traces.txt'
Note: I understand the issue with org/tempuri and will correct.
(Can't post image of my workspace as I am a new user)
Find Properties -> Java Build Path -> Order and Export
Change Android Dependencies order
Try to create a new folder called libs under your project and put the .jar file there...
I had the same problem, I tried to mark the Android Private Libraries under Order and Export and it didn't work for me. Then I noticed that my libs folder wasn't referenced under the Java Build Path. So I just added it to Libraries and it worked.
Go to
Project> Build Path >Configure Build Path
Check the Libraries you wanted and hit ok
Related
I have an app where homepage is map.
Do not know why i am getting this error and along with this error Could not find class 'gpr', referenced from method gps.a
I have updated eclipse so i tried to change to API key with new SHA1 fingerprint. But that does not work.
My app is to show current location when you open the app. It just landed into whole map but in LOG cat i get these error.
Here is my Logcat
`07-08 12:54:39.897: I/Google Maps Android API(25749): Google Play services client version: 5077000
07-08 12:54:39.907: I/dalvikvm(25749): Could not find method guj.a, referenced from method gqi.a
07-08 12:54:39.907: W/dalvikvm(25749): VFY: unable to resolve static method 24936: Lguj;.a (Landroid/content/Context;)Lgri;
07-08 12:54:39.907: D/dalvikvm(25749): VFY: replacing opcode 0x71 at 0x0003
07-08 12:54:39.917: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.917: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.917: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.927: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.927: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.927: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.927: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.927: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.927: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0c in Lgps;.a
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-08 12:54:39.957: I/Google Maps Android API(25749): Google Play services package version: 5084034
07-08 12:54:39.977: W/dalvikvm(25749): VFY: unable to resolve static field 20873 (t) in Lyp;
07-08 12:54:39.977: D/dalvikvm(25749): VFY: replacing opcode 0x62 at 0x000e
07-08 12:54:39.977: W/dalvikvm(25749): VFY: unable to resolve static field 20873 (t) in Lyp;
07-08 12:54:39.977: D/dalvikvm(25749): VFY: replacing opcode 0x62 at 0x000d
07-08 12:54:40.888: I/dalvikvm(25749): Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lgln;'
07-08 12:54:40.888: W/dalvikvm(25749): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
07-08 12:54:40.898: E/dalvikvm(25749): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
07-08 12:54:40.898: W/dalvikvm(25749): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt;
07-08 12:54:40.898: D/dalvikvm(25749): VFY: replacing opcode 0x1f at 0x0019
07-08 12:54:41.589: W/ActivityThread(25749): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());`
I tried to Google it around and it seems there is no proper solution yet so it would be helpful if anybody could help me with this.
I show you how I solved the same problem you have.
First of all, I cleaned all sdk and I downloaded again Google Play Services lib. Then I removed .android folder of my computer and I regenerated my debug.keystore.
After that, I just get my new SHA1 to obtain my Google Maps V2 Api Key.
After update my apikey, let's see how I change my code.
Now I use fragment with MapFragment insted of MapView in your xml layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
And use FragmentManager to locate it:
public class MapsActivity extends Activity
{
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Gets the MapView from the XML layout and creates it
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.getUiSettings().setMyLocationButtonEnabled(false);
//map.setMyLocationEnabled(true);
map.setOnMapClickListener(this);
map.setOnMapLongClickListener(this);
try
{
MapsInitializer.initialize(MapsActivity.this);
}
catch (Exception e)
{
e.printStackTrace();
}
}
I hope that's helpfull and sorry if my english is so bad,
regards
I had the same issue after upgrading to API Level 23 in July (with client google-play-service_lib 5.0.77).
The issue was resolved after Google Play Service was updated to latest (6.1.09) on the test device.
So, it seems to have been (a device-specific issue) due to incompatibility between the Google Play Service version on the device/emulator and the client library API (google-play-service_lib) in the project.
According to Google's documentation, when the client is newer than the service, the client library API is supposed to resolve out-of-date service apk issues; (and it does in this case since the issue does not really affect released apk's) https://developer.android.com/google/play-services/index.html.
My earlier attempts to resolve this issue by using new API key, and fresh installs of Eclipse/ADT/SDK/google-play-service_lib, as suggested in this and other similar questions did not work.
Could you post your manifest? Sans API key, of course.
Your log looks almost identical to mine for a problem I've had recently, which was fixed by adding the following to the manifest:
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
I'm working on an application that was accessing maps just fine, then stopped out of the blue. I couldn't see anything actually pointing to a missing permission; I only picked up on it when I compared the manifest with another application that used maps api v2.
I'm still confused as to why it previously worked without it (Google says you need the permission for maps to work). Perhaps I'd once put it there and accidentally deleted the line, but either way putting it in is what fixed it.
Source:
https://developers.google.com/maps/documentation/business/mobile/android/config
I am trying to include thquinn's DraggableGridView into my project. I followed all the instructions given there for getting started including these steps for adding a jar to my project. (DraggableGridView.jar is showing as a referenced library.)
It compiles correctly, but when run my project I get the following error in Logcat:
I/dalvikvm(798): Could not find method com.animoto.android.views.DraggableGridView.addView, referenced from method com.example.GuessWhat.GuessWhat.loadImages
W/dalvikvm(798): VFY: unable to resolve virtual method 11: Lcom/animoto/android/views/DraggableGridView;.addView (Landroid/view/View;)V
D/dalvikvm(798): VFY: replacing opcode 0x6e at 0x003a
E/dalvikvm(798): Could not find class 'com.animoto.android.views.DraggableGridView', referenced from method com.example.GuessWhat.GuessWhat.onCreate
W/dalvikvm(798): VFY: unable to resolve check-cast 15 (Lcom/animoto/android/views/DraggableGridView;) in Lcom/example/GuessWhat/GuessWhat;
D/dalvikvm(798): VFY: replacing opcode 0x1f at 0x0023
D/AndroidRuntime(798): Shutting down VM
W/dalvikvm(798): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
E/AndroidRuntime(798): FATAL EXCEPTION: main
E/AndroidRuntime(798): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.GuessWhat/com.example.GuessWhat.GuessWhat}: android.view.InflateException: Binary XML file line #3: Error inflating class com.animoto.android.views.DraggableGridView
E/AndroidRuntime(798): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime(798): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(798): at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(798): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(798): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(798): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(798): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(798): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(798): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(798): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
Here's my import:
import com.animoto.android.*;
In my activity I have:
DraggableGridView dgv = ((DraggableGridView) findViewById(R.id.dgv));
ImageView iv = new ImageView(getApplicationContext());
iv.setImageDrawable(new BitmapDrawable(Images[index]));
dgv.addView(iv);
The last line is where the build error is. What am I missing?
First of all, as Eclipse can resolve your dependency but Dalvik cannot, it seems that the library wasn't bundled with your application. The typical cause of this is adding your library as a normal Java dependency into /lib, whereas building for Android expects the jar in /libs. See also this question.
Secondly, looking at the source, it appears that your import is not specified correctly. DraggableGridView's qualified name is com.animoto.android.views.DraggableGridView.
Your activity should declare the import as:
import com.animoto.android.views.DraggableGridView;
My android Project on playing piano music, so i added jfugue.jar to my project.
my java code is:
line no:29 Player player=new Player();
line no:30 player.play("C D E F G A B");
the above code is written in button onclick listener. when i am clicking on that button i got RunTimeEexception, as below:
02-25 09:20:54.062: W/dalvikvm(846): VFY: unable to find class referenced in signature (Ljavax/sound/midi/Sequencer;)
02-25 09:20:54.082: I/dalvikvm(846): Could not find method javax.sound.midi.MidiSystem.getSequencer, referenced from method org.jfugue.Player.<init>
02-25 09:20:54.082: W/dalvikvm(846): VFY: unable to resolve static method 3600: Ljavax/sound/midi/MidiSystem;.getSequencer (Z)Ljavax/sound/midi/Sequencer;
02-25 09:20:54.082: D/dalvikvm(846): VFY: replacing opcode 0x71 at 0x0011
02-25 09:20:54.092: W/dalvikvm(846): VFY: unable to find exception handler at addr 0x1c
02-25 09:20:54.102: W/dalvikvm(846): VFY: rejected Lorg/jfugue/Player;.<init> (Z)V
02-25 09:20:54.102: W/dalvikvm(846): Verifier rejected class Lorg/jfugue/Player;
02-25 09:20:54.122: D/AndroidRuntime(846): Shutting down VM
02-25 09:20:54.122: W/dalvikvm(846): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
02-25 09:20:54.152: E/AndroidRuntime(846): FATAL EXCEPTION: main
02-25 09:20:54.152: E/AndroidRuntime(846): java.lang.VerifyError: org/jfugue/Player
02-25 09:20:54.152: E/AndroidRuntime(846): at com.example.xyz.MainActivity$1.onClick(MainActivity.java:29)
I never used jFugue, but it looks like your problem is that Android doesn't implement javax.sound.midi. So you need to find/develop an implementation of this package.
Here are some options discussed: A simple free MIDI implementation in Java besides javax.sound.midi: Are there any?
Where have you inserted your jar file.?
Also please check if you have build the jar file.
I've got a few problems with my running projet but this one is the worst :
String url="jdbc:oracle:login/pwd#host:1521:etudom";
Connection co = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
co= DriverManager.getConnection(url);
popUp("Ok");
}
// Driver Oracle : Should never happen
catch (ClassNotFoundException e){
popUp("ERROR: Oracle Driver's missing");
//System.exit(1);
}
// Internet Connection Problem
catch (SQLException e) {
popUp("ERREOR : " + e.getMessage());
//System.exit(1);
}
here's the log with OJDBC14 :
01-12 22:37:14.876: D/dalvikvm(558): Not late-enabling CheckJNI (already on)
01-12 22:37:16.867: D/gralloc_goldfish(558): Emulator without GPU emulation detected.
01-12 22:38:01.996: E/dalvikvm(558): Could not find class 'javax.management.MBeanServer', referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.006: W/dalvikvm(558): VFY: unable to resolve check-cast 706 (Ljavax/management/MBeanServer;) in Loracle/jdbc/driver/OracleDriver;
01-12 22:38:02.006: D/dalvikvm(558): VFY: replacing opcode 0x1f at 0x002d
01-12 22:38:02.006: I/dalvikvm(558): Could not find method java.lang.management.ManagementFactory.getPlatformMBeanServer, referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.006: W/dalvikvm(558): VFY: unable to resolve static method 3503: Ljava/lang/management/ManagementFactory;.getPlatformMBeanServer ()Ljavax/management/MBeanServer;
01-12 22:38:02.016: D/dalvikvm(558): VFY: replacing opcode 0x71 at 0x0080
01-12 22:38:02.016: I/dalvikvm(558): Could not find method java.lang.management.ManagementFactory.getPlatformMBeanServer, referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.027: W/dalvikvm(558): VFY: unable to resolve static method 3503: Ljava/lang/management/ManagementFactory;.getPlatformMBeanServer ()Ljavax/management/MBeanServer;
01-12 22:38:02.027: D/dalvikvm(558): VFY: replacing opcode 0x71 at 0x0094
01-12 22:38:02.036: I/dalvikvm(558): Could not find method java.lang.management.ManagementFactory.getPlatformMBeanServer, referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.036: W/dalvikvm(558): VFY: unable to resolve static method 3503: Ljava/lang/management/ManagementFactory;.getPlatformMBeanServer ()Ljavax/management/MBeanServer;
01-12 22:38:02.036: D/dalvikvm(558): VFY: replacing opcode 0x71 at 0x00a8
01-12 22:38:02.036: I/dalvikvm(558): Could not find method java.lang.management.ManagementFactory.getPlatformMBeanServer, referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.036: W/dalvikvm(558): VFY: unable to resolve static method 3503: Ljava/lang/management/ManagementFactory;.getPlatformMBeanServer ()Ljavax/management/MBeanServer;
01-12 22:38:02.036: D/dalvikvm(558): VFY: replacing opcode 0x71 at 0x00bc
01-12 22:38:02.046: I/dalvikvm(558): Could not find method java.lang.management.ManagementFactory.getPlatformMBeanServer, referenced from method oracle.jdbc.driver.OracleDriver.registerMBeans
01-12 22:38:02.046: W/dalvikvm(558): VFY: unable to resolve static method 3503: Ljava/lang/management/ManagementFactory;.getPlatformMBeanServer ()Ljavax/management/MBeanServer;
01-12 22:38:02.046: D/dalvikvm(558): VFY: replacing opcode 0x71 at 0x00d1
01-12 22:38:02.046: W/dalvikvm(558): VFY: unable to resolve exception class 702 (Ljavax/management/JMException;)
01-12 22:38:02.046: W/dalvikvm(558): VFY: unable to resolve exception class 702 (Ljavax/management/JMException;)
01-12 22:38:02.046: W/dalvikvm(558): VFY: unable to resolve exception class 702 (Ljavax/management/JMException;)
01-12 22:38:02.046: W/dalvikvm(558): VFY: unable to find exception handler at addr 0xfa
01-12 22:38:02.046: W/dalvikvm(558): VFY: rejected Loracle/jdbc/driver/OracleDriver;.registerMBeans ()V
01-12 22:38:02.046: W/dalvikvm(558): VFY: rejecting opcode 0x0d at 0x00fa
01-12 22:38:02.046: W/dalvikvm(558): VFY: rejected Loracle/jdbc/driver/OracleDriver;.registerMBeans ()V
01-12 22:38:02.056: W/dalvikvm(558): Verifier rejected class Loracle/jdbc/driver/OracleDriver;
And I always get the ClassNotFound exception and it's driving me crazy!
I used the same Driver for a Command line project and it works well.
If any one have any clue it would be great...
Thanks by advance and sorry for my bad English.
Thomas.
Newer Oracle drivers (at least ojdbc6.jar, maybe earlier ones as well) do not work on Android. They require several classes from the Java Standard Edition (Java SE) that are not available on the stripped down Android platform.
Update:
The error message is pretty clear:
Could not find class 'javax.management.MBeanServer'
This is a Java SE class that's missing on Android. It might want to have a look at the question Android Oracle Database JDBC6. This user was able to use ojdbc14.jar on Android.
Possibly he/she used the Oracle client differently, e.g. Class.forName("oracle.jdbc.OracleDriver"); instead of Class.forName("oracle.jdbc.driver.OracleDriver");. Or he/she used a different connection string that internally uses different classes. Or it's an older driver even though is called ojdbc14.jar as well.
Anyhow there's no guarantee that it will ever work. Oracle Java client is build for Java SE and not for the Android Java, which only contains those classes that are normally used on a mobile device.
I am writing a project that uses LruCache, which is included in the android-support-v4.jar compat library. When running on devices with JB, the code works fine, but when I run it on my Droid X with GB, the app dies with the following errors:
I/dalvikvm(2459): Could not find method android.util.LruCache.put, referenced from method blah.blah.Utility.getBitmap
W/dalvikvm(2459): VFY: unable to resolve virtual method 2641: Landroid/util/LruCache;.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
D/dalvikvm(2459): VFY: replacing opcode 0x6e at 0x0026
... [repeats similar lines] ...
W/dalvikvm(2459): Unable to resolve superclass of Lblah/blah/Utility$1; (353)
W/dalvikvm(2459): Link of class 'Lblah/blah/Utility$1;' failed
E/dalvikvm(2459): Could not find class 'blah.blah.Utility$1', referenced from method blah.blah.Utility.initCaches
W/dalvikvm(2459): VFY: unable to resolve new-instance 559 (Lblah/blah/Utility$1;) in Lblah/blah/Utility;
D/dalvikvm(2459): VFY: replacing opcode 0x22 at 0x000d
D/dalvikvm(2459): VFY: dead code 0x000f-002c in Lblah/blah/Utility;.initCaches (ILandroid/content/Context;)V
I/dalvikvm(2459): Could not find method android.util.LruCache.get, referenced from method blah.blah.Utility.mCacheGet
W/dalvikvm(2459): VFY: unable to resolve virtual method 2640: Landroid/util/LruCache;.get (Ljava/lang/Object;)Ljava/lang/Object;
D/dalvikvm(2459): VFY: replacing opcode 0x6e at 0x0008
D/dalvikvm(2459): VFY: dead code 0x000b-000e in Lblah/blah/Utility;.mCacheGet (Ljava/lang/String;)Landroid/graphics/Bitmap;
... [repeats similar lines] ...
D/AndroidRuntime(2459): Shutting down VM
W/dalvikvm(2459): threadid=1: thread exiting with uncaught exception (group=0x40018560)
E/AndroidRuntime(2459): FATAL EXCEPTION: main
E/AndroidRuntime(2459): java.lang.NoClassDefFoundError: blah.blah.Utility$1
E/AndroidRuntime(2459): at blah.blah.Utility.initCaches(Utility.java:49)
E/AndroidRuntime(2459): at blah.blah.MainActivity.onCreate(MainActivity.java:40)
... [etc] ...
W/ActivityManager(1318): Force finishing activity blah.blah/.MainActivity
Utility.java:49 looks like this:
mCache = new LruCache<String, Bitmap>( mCacheSize ) // <-- line 49 --
{
#Override
protected int sizeOf( String key, Bitmap bitmap )
{
return bitmap.getByteCount();
}
};
So everywhere I referenced LruCache or its methods causes an error. The first thing that comes to mind is that android-support-v4.jar was somehow left out of the APK file, but that doesn't look like the case. I've placed the jar file under libs/, and checking classes.dex.d after running ant debug, I see that it has added the following line:
/home/paul/workspace/blah/libs/android-support-v4.jar \
My second thought was that maybe LruCache isn't in android-support-v4, but looking at the source I see that the following source file is in there, and that it has the methods I am trying to use:
/home/paul/bin/android-sdk/extras/android/support/v4/src/java/android/support/v4/util/LruCache.java
So why isn't it found?
The classes in the support library use a different namespace.
You need to import:
import android.support.v4.util.LruCache;
or alternatively you can copy & compile LruCache.java directly into your app.