bluebeat
bluebeat

Reputation: 71

Many error messages after updating Gradle plugin for Android to 2.0.0

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.

Upvotes: 4

Views: 1028

Answers (1)

Wing Poon
Wing Poon

Reputation: 1231

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.

Upvotes: 2

Related Questions