Android Support Design gradle error

1.5k views Asked by At

This was my build.gradle file:

...
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:cardview-v7:21.0.+'
    ...
}

before I add:

compile 'com.android.support:design:22.2.0'

Now when I build or rebuild my project (I've synced gradle a few times) I get this errors:

.../utils/CustomEditText.java
Error:(6, 42) Gradle: error: cannot find symbol class TintEditText
Error:(14, 35) Gradle: error: cannot find symbol class TintEditText
Error:(37, 8) Gradle: error: cannot find symbol method isInEditMode()
Error:(57, 3) Gradle: error: cannot find symbol method setTypeface(Typeface)
Error:(65, 5) Gradle: error: method does not override or implement a method from a supertype
Error:(67, 23) Gradle: error: cannot find symbol variable super
...

Inside my CustomEditText (that extends TintEditText) and inside all Activities that use that CustomEditText.

The import doesn't throw any error nor the Class:

import android.support.v7.internal.widget.TintEditText;


What could it be?

UPDATE: Using ianhanniballake suggestion, AppCompatEditText instead of the internal TintEditText, solves the compile time error and answers this question but now I'm having a run time error:

java.lang.IllegalArgumentException: AppCompat does not support the current theme features 

I've seen some question related to this and the solution mentioned was something like:

<style name="MyMaterialTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        ...
</style>

But I don't want to fallow this approach because I've some Activities that use ActionBar and others who don't. My styles are:

<style name="MyTheme" parent="Theme.AppCompat.Light">
        <item name="colorControlNormal">@color/txt_light_grey</item>
        <item name="colorControlActivated">@color/default_orange</item>
        <item name="colorControlHighlight">@color/txt_light_grey</item>
    </style>

    <style name="MyTheme.ActionBar.Orange" parent="MyTheme">
        <item name="windowActionBarOverlay">false</item>
        <item name="colorPrimary">@color/default_orange</item>
    </style>

    <style name="MyTheme.FullScreen" parent="MyTheme">
        <item name="windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

And inside my base Activity I do:

getWindow().requestFeature(mActionBarView != null ? Window.FEATURE_ACTION_BAR : Window.FEATURE_NO_TITLE);

To enable or disable the ActionBar.
As I've stated this works pretty well until I add 'com.android.support:design:22.2.0' or update appcompat-v7:22.0.0 to 22.2.0. I just want to use a TabLayout, but I guess I'll not...

1

There are 1 answers

5
ianhanniballake On BEST ANSWER

As of version AppCompat 22.1.0, you should use AppCompatEditText instead of the internal TintEditText.