I am currently having this error. I am using API 21 and I know some folks here suggested to upgrade it to API 22 base on previous questions but the tutorial(Slidenerd of Youtube) I am following is using API 21 and did not encountered any errors like this. Weird thing also because my RecyclerView in emulator is just working fine as expected in his tutorial and I don't why this error keeps popping up. Thanks !
It is not an error. Because the constructor is getting called while viewing the layout. Normally there are some operations which are going to be executed. To avoid this there is View.isInEditMode().
Normally you would use it like this
public Constructor(){
if(View.isInEditMode())
return;
}
If I understand your question correctly you are talking about the message the preview window of your layout is giving you?
You are probably using a version of recycler view that is newer than your compile version.
In you build.gradle file where you have added recyclerview to your dependencies you can try downgrading the version you are using
Change compile 'com.android.support:recyclerview-v7:22.2.1'
to compile 'com.android.support:recyclerview-v7:21.0.3' (or change to a 21.x.x version that suits your needs
Related
I use recyclerveiw in my android app,
I use firebase-ui:2.1.0 in my gradle,but I find that if my android is 6.0 or over,
my app will bug.
So I update my dependencies to firebase-ui:3.1.0.
(refer to this link )
But It happened this error message:
How could I solve this problam? plz
I had the same problem.
Just make sure your
compile 'com.android.support:appcompat-v7:26.1.0'
version is the same as
targetSdkVersion 26
Mine was different and changing just this solved the problem.
After a year of coding in android and everything working perfectly till yesterday. Today, I found something really strange after upgrading to gradle 3 alpha 2 and studio 3 build 2.
This is the declaration of one of the activities throwing error:
This is the activity code:
What is wrong?
EDIT
appcompat dependency:
compile 'com.android.support:appcompat-v7:23.2.1'
Maybe this will help:
In the app build.gradle, change compileSdkVersion and targetSdkVersion to 25.
Also upgrade the version of the appcompat library to 25.3.1:
compile 'com.android.support:appcompat-v7:25.3.1'
UPDATE 05/31/2017:
As #cricket_007 pointed out to me in comments, it isn't caused by a problem with the non-existence of AppCompatActivity, as I had theorized (in comments).
And while I have not been able to track it down, it looks like the lint checking is behaving differently or misbehaving on Android Studio 3 Preview, or in the 3.0.0 alpha2 version of Android Gradle Plugin, some build tools versions (or somewhere).
If your code is compiling ok (in spite of the "assignable" complaint appearing in AndroidManifest.xml) and you want to keep using Android Studio 3 Preview, maybe it's worth trying to suppress "AndroidDomInspection" on that activity tag for now:
<!--suppress AndroidDomInspection -->
<activity android:name=".admin.AdminChangeCoach">
. . .
</activity>
But, FWIW, I also agree with #cricket_007's earlier comment: I'm not using Android Studio 3 for production yet either.
As an alternative ways, you can simply change the class that you extended to Activity class instead of AppCompatActivity.
I'm working on Android Studio on some one else's code that uses Volley.
I updated inside gradle to latest compileSdkVersion, buildToolsVersion (24) and targetSdkVersion.
Inside gradle configuration, volley was included in this way:
compile 'com.mcxiaoke.volley:library:1.+'
I migrated to:
compile 'com.android.volley:volley:1.+'
I get some nasty 400 error, that should mean that the connection is done but it is for some reason wrong... then I found that inside Volley.java there's an error that I was not aware of, because it simply wasn't shown and the app was correctly compiled and run:
import android.net.http.AndroidHttpClient;
is in red and so is the subsequent call to a method in
AndroidHttpClient
(that fails with "symbol not found").
Now I have two questions:
how is it possible that I compile and run the application if there is an error in a library? I'm missing this.
how can I fix this, without moving to other network libraries?
Update:
to clarify, compiling to API 22 removes the error. compiling to API 24 creates this error that appears directly inside Volley's source. I would like to compile to API 24 without Volley, is it possible?
This is Tutorial which i am following.
Please help me out from this error. Rebuild is not solving the problem.
Does your build.gradle file contain the line below?
compile 'com.android.support:design:22.2.0'
You must include support libraries (like the ones below), yet this is sometimes not sufficient.
compile ("com.android.support:support-v4:23.3.0")
compile ("com.android.support:appcompat-v7:23.3.0")
compile ("com.android.support:support-annotations:23.3.0")
compile ("com.android.support:recyclerview-v7:23.3.0")
compile ("com.android.support:design:23.3.0")
Examine your layout in design view, and click on Show Exception
This answer will help if you have the following problem:
You need to use a Theme.AppCompat theme (or descendant) with the design library.
In your Manifest file, include in your application declaration
android:theme="#style/Theme.AppCompat"
Rebuild and your problem should be solved.
First things first :
If you are using the lastest sdk28 TextInputLayout is having some bug. At least mine did (date: 22 Sept 2018 ) NOT work.
To make it work the best way is to use slightly lower SDK for you target and compile SDK version. (I used sdk 27 and everything worked out fine then.)
To use TextInputLayout and then its features such as "floatinghinttext" you need to update your build.gradle(module.app) found in gradleScripts.
in dependencies add-
implementation 'com.android.support:design:25.0.0'
(if you get some error it must be of some latest version available, so use that instead of 25.0.0)
Note: The "compile" keyword is getting replaced by "implementation" for newer/all versions.
I am fairly new to android development, suggestions are welcomed. Please excuse if any mistakes committed.
I am trying to use Chromecast icon in my app. My problem is am still seeing the older version of cast image (without white filling on connected). How can I update it newer version with filling?
I followed the post here, and updated the settings in gradle build as but its not working
dependencies {
compile "com.android.support:mediarouter-v7:19.0.1"
}
Perhaps the answer confused you. You should use:
compile 'com.android.support:mediarouter-v7:20.+'