Databinding error in Android Studio 3.1 - android

My project was now building up good. Suddenly it started showing error in all DataBinding generated files. I cant find a way to get through it.

just invalidate cache and restart android studio, if still it don't work just try deleting build and .gradle folder.

Databinding removes all boilerplate codes, but it's hard to debug. If you get any sort of databinding error, kindly check the build error message properly. The errors are pointed out in the build message.
Note: If any of the databinding code has an error, you will get error for all databinding codes. So, it gets quite tough to get which file has the actual issue. The issue occurs mainly if you refractor any view id. Have a close look at at which places, you ids are getting changed.

Related

Android Manifest error when trying to build project

I have been trying to build my project for sometime now and each time i try to build it i get the error and a file comes up that i have no idea about (debug/AndroidManifest.xml)
I have invalidated caches and restarted several times to no avail.
i have cleaned the project several times and still getting the same. I even went further to toggle my build variants between release and debug. Still no solution
see the screenshot below
aapt error unexcepted element.
it means in the wrong level.
check or remove it.
Your intent filter is in wrong place. Where it shows that you commented out the activity which was supposed to use the intent. remove the line and build again.

How to resume a stuck code analysis in Android Studio?

I recently noticed a behaviour, that the default code analysis does not finish anymore in one of my android projects, in particular in kotlin files - unfortunately without an error message. With a stuck analysis I am not able to identify errors in my code anymore and basic stuff like autocompletion does not work, which makes it unable to work.
In the top right corner of the opened file I constantly get Analyzing...
I already tried restarting Android Studio, invalidating its cache, deleting and cloning my project again, rebooting and deleting all kind of gradle and Android Studio cache files but without success.
I finally got it working again with the help of the idea.log file, which can be found via Help > Show Log in Explorer in Android Studio.
The log stated an Exception while analyzing expression at different locations in my files, caused by java.lang.IllegalStateException: #NotNull method org/jetbrains/kotlin/builtins/KotlinBuiltIns.getBuiltInClassByFqName must not return null.
Since it looked like a Kotlin related issue, I upgraded org.jetbrains.kotlin:kotlin-stdlib-jdk7 in my build.gradle from 1.4.10 to 1.5.10 and it worked instantly again. I hope the info helps anyone!
Please remove butterknife plugin in Settings-> Plugin. It is worked for me in java files.

Android Room tutorial does not build

UPDATE: Solved! (see fix at the bottom)
I'm trying to go through the Android Room tutorial but get stuck on step3. I keep getting an error when trying to update the gradle file as specified by the tutorial.
https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#1
When trying to build, I get the following error:
Setting roomVersion to "2.1.0-alpha06" or just "2.1.0" generates the same type of error.
Is it only me or is there something wrong with this tutorial?
Anyone with an idea why the androidx.room:room-testing dependancy fails to build?
UPDATE:
I solved the issue by uninstalling Android Studio and re-installing it. I also needed to do a full cleanup and remove all "android studio" and "gradle" related files on my system. Maybe a bit overkill, but this is whats fixed it for me.

Android errors throughout project

I've got a project from Github, that I'm viewing in Android Studio (3.0 Preview). When I build the project I get 0 errors but when I'm viewing the projects files, I get a lot of errors about not matching Class types.
Examples
Wrong 1st argument type Found 'android.support.v7.appCompatActivity' expected 'android.App.Activity'
on
Utils.patchFiles(outerClass, TAG,
new Utils.DesiredFilesKeywordGetter(), type2files);
Cannot resolve method startActivity(android.content.Intent)
on
startActivity(intent)
even I had the same problem once.
In your android studio gp to
File ->Invalidate Cashes / Restart
Then Clean and Rebuild the app again.
Hope this will solve the problem.

Creating an android project does not create the R.java file for me and there appears to be gradle errors as well

I had a problem with my android studio not creating the R.java file ( which its still not doing ) but ontop of that, im getting this error which I dont understand at all.
as well as this error
Please help.
This might java error.
check your java version you might need to update your java.

Categories

Resources