I followed the official migration: https://developer.android.com/jetpack/androidx/migrate
The migration worked perfectly.
In my project, I use several third libraries. The complete build of my entire project works.
BUT now from Android Studio, I have a lot of syntax errors (from the editor, not after the build!). ie with the third-party "advrecyclerview" where the property "itemView" doesn't know now because:
So how can I change editor syntax analysis, etc. have you got some solutions?
Thank you very much
In your question you are using the wrong recycler view.
If you follow the link you posted, you will see the new package should be
androidx.recyclerview:recyclerview:1.0.0
(which means androidx.recyclerview in imports)
You need to make sure to change the XML to match
Edit
As it is in a library, make sure to enable Jetifier to auto-fix the libraries. It can still fail, but it does a good job for the majority.
You need to put the following gradle.properties:
android.enableJetifier=true
android.useAndroidX=true
More information on this is in the migration document
Ok guys, I found the problem: from Android Studio, I did "Invalide Caches and Restart", and the editor syntax works perfectly now.
Related
I'm new to Android, Was learning from youtube from following playlist
https://www.youtube.com/watch?v=d1T0ptCAs8A&list=PLraJmOvF9eeGyVClKdBaVU6O_XqQjNboS&index=5
In 4th video it was teaching to add Firebase, but it was old method as I got some new option on Firebase(Firebase was saying It needs only classpath 'com.google.gms:google-services:4.2.0')
suddenly after adding this line in build.graddel in project I saw that my previously working code have some errors
I tried Invalidate cashes and restart, cleaned projects and rebuild.
It seems you are mixing support library and androidx
either use androidx(recommended) or support library
follow https://developer.android.com/jetpack/androidx/migrate guide and after this make sure to make appropriate changes in layout xml files also.
Remove the dependencies with androidx starting. Because androidx is a different library than support library. You should only include one of them.
i've ben facing this and tried to solve without any luck. Below are the error out put and my gradle file. Before marking this as duplicate i would like to point out almost all the suggested ways didn't work for me.
What i have tried so far
set multiDexEnabled to true
un-commented the line org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 in my gradle.properties file
change my application class to extend MultiDexApplication instead of Application
Check if i have duplicates class and i don't
updated android studio and google play services to latest versions (3.1.2 for android studio)
cleaned the project and even deleted .gradle file
any help will be appreciated. thanks in advance
so if anyone in the future will be having having this, the correct way for me was to check my library versions that utilize live data. As the error suggests, it had an association with live data. You don't have to implement live data to get this error but utilizing any library that has connection with live data can lead to this problem.
In my case it was Firebase ui library as i updated android support library to 27.1.0.
so i also updated firebase ui ,library to 3.2.2.
as per google, this was an Intended behavior so the only thing to fix that is to update firebase ui library to a version that supports library 27.1.0.
as suggested here
The problem
Under "External Libraries" in the project view of an Android Studio project I have these libraries "stax-stax-api:1.0.1#jar" and "xpp3:xpp3:1.1.3.3#jar". They're causing me problems such that I can't build the project. I can't seem to figure out how they got there or where they're being used.
The error message I get when I build right now is:
"Error:Error: xpp3 defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]"
The error message is good except that it doesn't tell me who's using this lib in the first place.
The question
Is there an easy way to find out where they're being used in the project? Or even a way that it's easy but doesn't require looking at every file? It's a multi module project with lots of files. If I could delete them this would tell me but there's no delete option.
This could be something really simple that I'm overlooking. Any help appreciated. Happy to add more info as requested.
What I've tried
I've tried to "Analyze Dependencies" but it doesn't show me any references that I can see.
Update: I forgot to mention that I've also tried ./gradlew app:dependencies but it only tells me that my project depends on these libraries. I already know this. Is there a way to get some more specific information so I can remove the libraries?
Update 2: The accepted answer does work but I needed to redirect console output.
gradle app:dependencies
It will show you the dependencies tree of your project
At this link it is explained quite well about the command and how to use it.
Use this to redirect console output if it's clipped:
./gradlew app:dependencies > dependencies.txt
Project can be explored in "Project-tool-window" to have a look at the used external libraries which are not visible in "Android tool Window".
https://www.jetbrains.com/help/idea/project-tool-window.html
That way I solve my problem. Hope it help.
I'm trying to include in my project GreenDAO ORM, useless to say that there is no good tutorial that makes it work from scratch and there is ridiculous documentation on the official site. I used this greendao tutorial and made all intermediary steps to generating classes with gradle task. But now I'm stuck, Android Studio gives me an error for every generated class like:
Cannot resolve symbol 'AbstractDaoMaster'. All imports are actually in place but there is no way to make it work.
Things I tried:
invalidating caches
updating AS to 1.2.1.1
I have iMac OS X Yosemite 10.10.2
I have no clue what to do next.
The documentation on the official site it's a bit old, for Eclipse projects. Using Android Studio I always follow this tutorial, it worked always like charm.
I am sorry I didn't find your question in time - the answer was already in the 2nd part of the tutorial you mentioned:
compile files('libs/greendao-1.3.7.jar')
For the future, I really recommend adding Gradle dependency for greenDAO, instead of a jar file. It's more flexible and easy this way. Just add compile 'de.greenrobot:greendao-generator:2.1.0' to build.gradle and sync it. You can always check the last version here.
See this blog post for a step by step tutorial with explanation.
I actually had to update build.gradle in the app module with:
compile files('libs/greendao.jar')
and manually sync gradle scripts with project files. After that, all dependencies are met.
In my app, I am using Pull TO Refresh list view library. I had designed layouts for all screens respectively. When I ran lint on my project, in one of my layout file for xlarge screen, it gave me fatal error:
Class referenced in the layout file,
com.handmark.pulltorefresh.library.PullToRefreshListView, was not
found in the project or the libraries
While in same layout file for other screens, it is giving no error at all. Also, I had used same library in other layouts of my file, where it does not give any error. It is giving same error for Google Maps api as well. My project targets Google Api level 16 and I had checked, all libraries are added to it. But,the error doesn't go away even on cleaning project.
This is a lint bug and you can safely ignore it. Lint is meant to help, not to hinder your development time. Change the lint Errors to warnings and you can compile and run the app just fine. I don't recommend turning it off because it helps to keep your code cleaner.
Make a project Project -> Clean... this resets the bug errors for me.
I was also getting a similar error, for me, it was resolved by adding android.enableJetifier=true to gradle.properties.
You can suppress the lint error by, passing the error type to the ignore attribute within that view, for example:
<com.handmark.pulltorefresh.library.PullToRefreshListView
...
tools:ignore="MissingClass"
...
/>
Just make sure you have tools imported:
xmlns:tools="http://schemas.android.com/tools"
References:
https://googlesamples.github.io/android-custom-lint-rules/checks/MissingClass.md.html
It happened to me when i changed thé android studio IDE, To solve it:
-reate a new project;
-replace the content of dependencies in build.gradle of your project with the content of dependencies in build.gradle of the new project;
-sync project with gradle.
And it will work.