Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find class 'android.widget.ThemedSpinnerAdapter' [Android Studio]

I am getting this weird error when I try to run my app on a pre API 21 device:

I/Choreographer: Skipped 39 frames!  The application may be doing too much work on its main thread.
12-10 07:58:44.179 4469-4472/projects.test.com.webviewtest D/dalvikvm: GC_CONCURRENT freed 156K, 4% free 4561K/4744K, paused 4ms+12ms, total 76ms
12-10 07:58:44.409 4469-4469/projects.test.com.webviewtest I/dalvikvm: Could not find method android.widget.Spinner.getPopupContext, referenced from method android.support.v7.widget.AppCompatSpinner.getPopupContext
12-10 07:58:44.409 4469-4469/projects.test.com.webviewtest W/dalvikvm: VFY: unable to resolve virtual method 18719: Landroid/widget/Spinner;.getPopupContext ()Landroid/content/Context;
12-10 07:58:44.409 4469-4469/projects.test.com.webviewtest D/dalvikvm: VFY: replacing opcode 0x6f at 0x000b
12-10 07:58:44.419 4469-4469/projects.test.com.webviewtest I/dalvikvm: Could not find method android.content.Context.getDrawable, referenced from method android.support.v7.widget.AppCompatSpinner.setPopupBackgroundResource
12-10 07:58:44.419 4469-4469/projects.test.com.webviewtest W/dalvikvm: VFY: unable to resolve virtual method 255: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
12-10 07:58:44.419 4469-4469/projects.test.com.webviewtest D/dalvikvm: VFY: replacing opcode 0x6e at 0x0004
12-10 07:58:44.429 4469-4469/projects.test.com.webviewtest I/dalvikvm: Could not find method android.widget.PopupWindow.showAsDropDown, referenced from method android.support.v7.widget.AppCompatPopupWindow.showAsDropDown
12-10 07:58:44.429 4469-4469/projects.test.com.webviewtest W/dalvikvm: VFY: unable to resolve virtual method 18641: Landroid/widget/PopupWindow;.showAsDropDown (Landroid/view/View;III)V
12-10 07:58:44.429 4469-4469/projects.test.com.webviewtest D/dalvikvm: VFY: replacing opcode 0x6f at 0x000d
12-10 07:58:44.459 4469-4469/projects.test.com.webviewtest I/dalvikvm: Could not find method android.widget.CompoundButton.drawableHotspotChanged, referenced from method android.support.v7.widget.SwitchCompat.drawableHotspotChanged
12-10 07:58:44.459 4469-4469/projects.test.com.webviewtest W/dalvikvm: VFY: unable to resolve virtual method 18333: Landroid/widget/CompoundButton;.drawableHotspotChanged (FF)V
12-10 07:58:44.459 4469-4469/projects.test.com.webviewtest D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
12-10 07:58:44.559 4469-4469/projects.test.com.webviewtest E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>
12-10 07:58:44.569 4469-4469/projects.test.com.webviewtest W/dalvikvm: VFY: unable to resolve instanceof 2184 (Landroid/widget/ThemedSpinnerAdapter;) in Landroid/support/v7/widget/AppCompatSpinner$DropDownAdapter;
12-10 07:58:44.569 4469-4469/projects.test.com.webviewtest D/dalvikvm: VFY: replacing opcode 0x20 at 0x0016

Actually I don not get a ANR or Unfortunately your app stopped working, the app silently exits to the Main Activity.

I am not using any heavyweight images in my application, just a page with a four spinners.

In particular, this line is highlighted in red:

E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>

However as I am not using eclipse, I am sure I have proper imports using gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "projects.test.com.webviewtest"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}
like image 242
User3 Avatar asked Dec 01 '15 07:12

User3


3 Answers

In my situation this was resolved by removing the use of android:tint="?attr/colorControlNormal" within the layout XML file... Maybe this helps others.

like image 148
Peter Avatar answered Oct 26 '22 02:10

Peter


I solved the problem looking to the compileSdkVersion in my project. I had 4 modules, 3 of them were compiling with the sdk 22, one was compiling with the sdk 23.

After I changed all of them to the sdk 22, problem solved. So my advice is to check the SDK version and select for all the modules in your project to the same number.

Cheers

like image 36
shaolin Avatar answered Oct 26 '22 02:10

shaolin


I also got same issue with spinner,it is running in some devices and not running in some devices. Because I put setAdapter(null). Because of that it is behaving like this. Instead of that put ArrayList arrayList = new ArrayList(); spinner.setAdapter(new ArrayAdapter<String>(activity.this, android.R.layout.simple_dropdown_item_1line, arrayList)); then it will be work in all devices.

like image 38
venkat Avatar answered Oct 26 '22 00:10

venkat