Rebuild error in android kotlin code java.lang.noSuchMethodError? - android

While trying to build an existing source code in android, I got an error like this.
Error: cannot generate view binders java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.FunctionReferenceImpl.(int, java.lang.Class, java.lang.String, java.lang.String, int)'
Please help me to solve the issue. Any clue regarding the error will be a great help.
Thank you!

This error message is indicating that there is a problem with the Kotlin library being used in your project. The specific issue is that there is no such method as void kotlin.jvm.internal.FunctionReferenceImpl.(int, java.lang.Class, java.lang.String, java.lang.String, int).
To resolve this issue, you can try the following steps:
Update the Kotlin library version: Make sure that you are using the latest version of the Kotlin library. Updating the library to the latest version may resolve the issue.
Check the build.gradle file: Check the build.gradle file to make sure that the correct version of the Kotlin library is being used.
Clean and Rebuild the project: Try cleaning and rebuilding the project to see if that resolves the issue. You can do this by going to the Build menu in Android Studio and selecting "Clean Project" and "Rebuild Project".
Invalidate caches and restart: Try invalidating the caches and restarting Android Studio to see if that resolves the issue. You can do this by going to the File menu in Android Studio and selecting "Invalidate Caches/Restart".
If none of these steps resolve the issue, it's possible that the issue is with the code and you may need to troubleshoot the specific lines of code that are causing the error.

Related

Androidx Migrate Error: cannot find symbol DaggerNetworkComponent

I'm new to android development and trying to migrate to androidx.
After migrating when I run the application on the device for testing it is giving following error:
cannot find symbol DaggerNetworkComponent
Dagger is not creating DaggerNetworkComponent for NetworkComponent and I don't know how to manually initiate the creation
Can anyone help me resolve this issue?
Thanks in advance
This issue is resolved.
I have updated my gradle version and then use the "Migrate to androidX" option.
After migration, clear and invalidate cache and do a clean build.
This worked for me.

org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression

I run a kotlin project successfully on my desktop, but when I import the same project on my laptop and when I rebuild the project, it's throwing "org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression".
As suggested in net, I tried with clean build, invalidate cache and restart. I deleted the cache folders and logs but no results.
I have tried Googling, but found no answer for this particular problem.
Details:
Current kotlin plugin version: 1.3.61-release-Studio3.5-1, latest version of plugin is installed, using Android Studio 3.5.2
Any help is apreciated!
I was facing a similar error, updating Kotlin Plugin and restarting Android Studio fixed the issue for me
This seems to be a sync issue. To solve this, I performed these two steps in succession and then re-ran the project:
Deleted the entire build folder
Build > Clean-Project
In my case I was missing some jar files that were required for the app to build. So if you encounter this, check if you have all required dependencies on your classpath.
In my case it was broken xml layout file (the expection message did not indicate the file).

Could not find com.google.android.gms:play-services-ads:11.0.2. Required by: project :

I am trying to compile project on android studio, and I keep geeting this error
Could not find com.google.android.gms:play-services-ads:11.0.2.
I just want to generate the apk, and I don't understand what cause this behavior.
Open your SDK Mangerand download
com.google.android.gms:play-services-ads:11.0.2
this will resolve your issue. Thanks

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.

Error NotificationCompatIceCreamSandwich has already been added to output. Please remove duplicate copies

I had my program building successfully but then I updated my Android Studio to version 1.0.
First I had this error after the update:
Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0-rc4.
Fix plugin version and re-import project
Then this error that I fixed by replacing runProguard by minifyEnabled:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
And finally this error appeared:
Error:Class android.support.v4.app.NotificationCompatIceCreamSandwich has already been added to output. Please remove duplicate copies.
I already looked in several places but couldn't find a solution. Does anyone know how to solve it? The project was building successfully until the update.
For those who might have the same problem as me, I solve my problem the hard way. The solution I found was create a new project with the same name, copy all the basic files (java, xml and drawable) to the new project and copy the lines I wanted from the manifest. After it builds the Gradle, it builds sucessfully. I think the reason must be about the new arrangement of foulders from the version 1.0
There must be a better way but until then, at least now it works. Thanks to those who tried to help

Categories

Resources