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.
Related
I have included okhttp3 and tested PATCH and DELETE methods in android versions less than LOLLIPOP (api 21). I did not include Okio and it worked fine. But, in the okhttp site they mention the following:
You'll also need Okio, which OkHttp uses for fast I/O and resizable buffers. Download the latest JAR.
Could anyone please confirm if Okio can be safely ignored to use OkHttp?
Additional info:
I saw the same warning logs with and without okio 1.14.0 in Android 4.1.2 Samsung Galaxy Note while making a PATCH call with OkHttp 3.10.0.
03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
03-02 14:18:39.850 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
03-02 14:18:39.855 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30883: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
03-02 14:18:39.855 6123-6159/ D/dalvikvm: VFY: replacing opcode 0x71 at 0x000b
03-02 14:18:39.860 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
03-02 14:18:39.865 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30882: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
okio is necessary for okhttp3 to work. However it is included automatically as a transitive dependency. So there is no need to include it explicitly.
Since updating Gradle Plugin for Android to 2.0.0, there are many error messages in all projects in Android Studio 2.0.
I would like to know the reason for this and possibly how to avoid it.
This seems not related to the code of my projects, as the errors also show up in an empty or blank project. There are in fact hundreds of lines of warnings and errors, even before first call of onCreate() in a blank project.
This is a small excerpt of the logged errors:
I/dalvikvm: Could not find method android.content.Context.getSystemService, referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve virtual method 450: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x004b
I/dalvikvm: Could not find method android.app.Activity.stopLockTask, referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve virtual method 246: Landroid/app/Activity;.stopLockTask ()V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x00b9
E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve check-cast 229 (Landroid/os/PersistableBundle;) in Lcom/example/test/MainActivity;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x00f1
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve virtual method 432: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0101
I/dalvikvm: Could not find method android.app.Activity.onVisibleBehindCanceled, referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve virtual method 169: Landroid/app/Activity;.onVisibleBehindCanceled ()V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0111
I/dalvikvm: Could not find method android.app.Activity.onWindowStartingActionMode, referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve virtual method 173: Landroid/app/Activity;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0137
E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.test.MainActivity.access$super
W/dalvikvm: VFY: unable to resolve check-cast 229 (Landroid/os/PersistableBundle;) in Lcom/example/test/MainActivity;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x019a
E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method com.example.test.MainActivity.access$super
With Gradle Plugin 1.5.0 everything went fine.
With Gradle Plugin 2.0.0 these errors come up.
I updated to 2.0.0, because Android Studio 2.0 recommends the update:
The project is using an old version of the Android Gradle plugin. To
take advantage of all the latest features, such as Instant Run, we
strongly recommend that you update the Android Gradle plugin to
version 2.0.0.
As there are hundreds of lines of errors at the start of any app and many more later, this makes using logcat for debugging extremely difficult.
I have tried to downgrade to 1.5.0 as described in this answer. This does actually prevent the errors to come up. Anyhow, I do not regard this as a solution, but rather a work-around, as I cannot use the new features of plugin 2.0.0.
Yes, unfortunately, the Android team decided to use the INFO rather than VERBOSE tag on these messages:
https://code.google.com/p/android/issues/detail?id=198567
The solution is to create a custom filter. Give it a [Filter Name]. Click [Edit Filter Configuration] on the right of the Android Monitor window toolbar. In the [Log Tag], enter "^(?!(dalvikvm))", minus the quotes, and make sure [Regex] is Checked next to it. In the [Package Name] field, enter your top-level package name (e.g. com.example.me). Select Debug for [Log Level] and click [OK]. Finally make sure to select your new filter back in the toolbar.
It doesn't seem to impact anything in my app... yet. I'm using the Android support libraries for the first time (my projects to date have not used support libraries), but this is a new project without much in the way of customization yet. Activities were generated by Android Studio 0.9.2 and implement Navigation Drawer.
Running this on a Verizon Samsung Galaxy SIII running Android 4.4.2. Project is set to minSDK of 15 and targeted SDK of 21.
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 11400: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 11406: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 8977: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
11-21 10:31:18.234 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
11-21 10:31:18.234 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 368: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
11-21 10:31:18.234 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-21 10:31:18.234 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
11-21 10:31:18.234 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 390: Landroid/content/res/TypedArray;.getType (I)I
11-21 10:31:18.234 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
If I'm guessing (and I am), I'm missing a library that android.support.v7 requires. But I have no idea what or where to find it.
I would like to add on top of what #Monte Creasor explained.
I have had the same issue and consulted this bug report which basically says that the problem might be caused by com.android.support:appcompat-v7:21.0.3, on of the main dependencies required to use Android's new Layout capabilities.
Try going back to the v7:20.0.0, this should solve the issue as it did for me and this bug report writer.
Actually all you have to change is in the app build.gradle the line:
compile 'com.android.support:appcompat-v7:21.0.3' or whatever later version you have
to
compile 'com.android.support:appcompat-v7:20.0.0'
These errors occur when you run android studio 1.0 using the sliding drawer sample WITHOUT adding any additional code and using all the defaults the project creation wizard offers. So it would seem to be an Android Studio problem and not a developer coding error.
I had the same issue, also I wasn't able to get my ListFragment scrollable. Used v4 support library 21.0.3 before and upgraded to 22.0.0.
This fixed my problems!
I'm currently going through my logs generated from using Sony's remote device lab, the same warning appears so it's not a Android Studio problem. I suspect its a problem with the ActionBar theme used during the development of the application.
I currently have the following libs added to the classpath (android project, minSDK 16):
Picasso 2.3.3
okhttp 2.0.0
okhttp-urlconnection 2.0.0 RC1
okio 1.0.1
Somehow Picasso refuses to work now and I'm getting the following error message:
VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
VFY: unable to resolve static method 8759: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
VFY: replacing opcode 0x71 at 0x000a
VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
VFY: unable to resolve static method 8758: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
VFY: replacing opcode 0x71 at 0x000a
Could not find method com.squareup.okhttp.OkHttpClient.setInternalCache, referenced from method com.squareup.okhttp.OkUrlFactory.setResponseCache
VFY: unable to resolve virtual method 6548: Lcom/squareup/okhttp/OkHttpClient;.setInternalCache (Lcom/squareup/okhttp/internal/InternalCache;)Lcom/squareup/okhttp/OkHttpClient;
VFY: replacing opcode 0x6e at 0x0009
Could not find method com.squareup.okhttp.OkHttpClient.setConnectTimeout, referenced from method com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.setConnectTimeout
VFY: unable to resolve virtual method 6541: Lcom/squareup/okhttp/OkHttpClient;.setConnectTimeout (JLjava/util/concurrent/TimeUnit;)Lcom/squareup/okhttp/OkHttpClient;
VFY: replacing opcode 0x6e at 0x0005
Could not find method com.squareup.okhttp.OkHttpClient.setReadTimeout, referenced from method com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.setReadTimeout
VFY: unable to resolve virtual method 6553: Lcom/squareup/okhttp/OkHttpClient;.setReadTimeout (JLjava/util/concurrent/TimeUnit;)Lcom/squareu
Is there any way to get those libs to work together?
Use okhttp-urlconnection 2.0.0, not the RC1.
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.