3

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...

GuilhE
  • 11,591
  • 16
  • 75
  • 116
  • I got this error too after updating to latest android design library..I just changed to Edittext. – Psypher Jun 15 '15 at 19:14

1 Answers1

6

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

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • What is the difference between AppcompatEdittext and the normal Edittext..I could not see any difference between them – Psypher Jun 15 '15 at 19:15
  • @Ranjith - as noted in the documentation and the blog post I linked to in the answer to this question, `EditText` automatically gets replaced with `AppCompatEditText` when you use `AppCompatActivity` or the equivalent so you wouldn't see a difference - `AppCompatEditText` is only useful if you are building a custom subclass of `EditText` but want the tinting provided by AppCompat. – ianhanniballake Jun 15 '15 at 19:18
  • TintEditText worked well with appcompat-v7:22.0.0 until I've added the design:22.2.0 that's strange. Well this fixes the compile time error but now I've a run time error: Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features – GuilhE Jun 16 '15 at 09:34
  • Going from 22.0.0 to 22.2.0 included the very large [Android Support Library 22.1.0 release](http://android-developers.blogspot.com/2015/04/android-support-library-221.html) - searching for the 'does not support the current theme' brings up the [answer from the author himself](http://stackoverflow.com/questions/29790070/upgraded-to-appcompat-v22-1-0-and-now-getting-illegalargumentexception-appcompa) – ianhanniballake Jun 16 '15 at 14:14
  • Before I post this question I was able to find Chris Banes's question but his solution didn't work for me. Since I'll only have 2 tabs I've used Google IO approach and it worked. Maybe later in the future if I have to take full advantage of TabLayout I can make it work . Thanks. – GuilhE Jun 17 '15 at 21:55