This question already has answers here:
I use gRPC to generate java code '#javax.annotation.Generated' and it reports 'Error:(20,18) java: cannot find symbol'. How to solve it?
(3 answers)
Closed 6 months ago.
This is my first time using IntelliJ so this is probably just a basic question but alas I have it anyways.
I have cloned a github project into IntelliJ that uses gradle. I import and first thing it says is that gradle is not set up right, so I set it up according to the following:
gradle prefrences Java version 14.0.1. Then it said the SDK was still not set up so I again set that up for again version even though I am not using Android.
I can successfully run a few of the grade tests but all of my java code no longer links methods and when I run the tests (directly from github without any changes yet) I get an error: cannot find symbol #javax.annotation.Generated(
Also all of the methods in my example seem to no longer link. I have a screenshot of this too.
Any guidance is appreciated, probably a problem in the set up? I found this symbol error a few times but no resolution that helped. I tried invalidating caches and restarting a few times. I deleted the .idea files a few times. tried a different repository in git and still having the same errors.
Thanks!
Simply add the javax annotation dependency into your build.gradle.
dependencies {
//...
implementation 'javax.annotation:javax.annotation-api:1.3.2'
//...
}
like so.
Related
I am trying to build a KMM project everything works fine in Android also in iOS simulator but when I connect an iOS device I get the below error .
FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ':shared:embedAndSignAppleFrameworkForXcode' (type 'Copy').
Type 'org.gradle.api.tasks.Copy' property 'sign' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
Assign a value to 'sign'.
Mark property 'sign' as optional.
Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#value_not_set for more details about this problem.
My gradle wrapper properties has 7.4.1, I have used 7.2 version as well same issue.
If anyone can tell me how to resolve this gradle issue to get the framework library ready for iOS project it will be very helpful thanks.
Meanwhile I ll try to figure out myself will update if I find any solution.
Looks like you are missing EXPANDED_CODE_SIGN_IDENTITY. Xcode sets this variable if you select an iOS device. For a simulator In my case, it sets it to -.
Kotlin multiplatform plugin requires this variable to be set for embedAndSignAppleFrameworkForXcode to work properly here.
I think updating Xcode may help. alternatively, you can set EXPANDED_CODE_SIGN_IDENTITY to - if it is not defined.
To do this just update your run script phase:
: "${EXPANDED_CODE_SIGN_IDENTITY:=-}"
./gradlew :shared:embedAndSignAppleFrameworkForXcode
Hopefully, it will help.
The answer is that you need go to 'Build Settings' -> 'Code Signing Identify' and make sure that you have a signing certificate set. You'll need to make sure you have a Team selected in 'Signing & Capabilities' as well.
I am trying to add Places SDK for android.
I am following the following documentation
https://developers.google.com/places/android-sdk/start and
https://developers.google.com/places/android-sdk/client-migration
Unfortunately i am not able to add dependency "implementation 'com.google.android.libraries.places:places:2.2.0'"
I have gone through following links. But no use. Please help me with this.
Failed to resolve: com.google.android.libraries.places:1.0.0:
Google's new Places Library ( implementation 'com.google.android.libraries.places:1.0.0') not resolving
Finally i found solution to my issue.
I solved it by installing the compatibility library.
Followed this. https://developers.google.com/places/android-sdk/client-migration
Following two steps resolved my issue.
Copy the contents of places_compat_compatify.sh, and save as a file to your local computer.
Use the following command to run the compatibility script
./places_compat_compatify.sh 2.1.0
After this, I could run my project successfully and could Place API.
Thanks
I'm trying to use IntelliJ IDEA for my UnetStack Project.
I'm following this blog
https://blog.unetstack.net/using-idea-with-unetstack
I get this error when done following this:
Error: Could not find or load main class org.codehaus.groovy.tools.GroovyStarter
I had the same issue.
This happened to you because you ran your simulation as a groovy script and not as the configured application. Run it as application and groovyStarter will not even be used.
I followed the Kotlin tutorial for eclipse here : Getting Started With Eclipse Luna
However, I'm running into this error:
Error: Could not find or load main class _DefaultPackage
Anyone who knows to get around this?
This was a severe bug (KT-10221) in automatic generation of Launch Configuration in plugin version 0.4.0. It was fixed in 0.5.0 so the recommendend way to workaround is to update plugin.
The source of the problem was that the plugin used an old pattern for generating name of the class for main function that had been abandoned by Kotlin compiler.
It's possible to workaround it by editing launch configuration (Eclipse Menu -> Run -> Run Configurations...) by hand and changing Main class field in Java Application group. If the file is named hello.kt with no package directive, as it is described in tutorial, than corrected string should be HelloKt.
If file has name other.kt with package my.tutorial than the Main Class should contain my.tutorial.HelloKt. You can read more about it in the section Package-Level Functions of Calling Kotlin From Java page.
I have been getting the same issue. And after putting the right compiler output path, it got resolved.
Go to Project -> Project Compiler output :
In the text box, fill this:
[Absolute Path]/{Project Name}/out
In my case I was having this problem while trying to run the program using the Application Gradle plugin. The problem was in the mainClassName property using single quotes instead of double ones
This didn't work:
mainClassName = 'demo.HelloWorldKt'
With double quotes, it works:
mainClassName = "demo.HelloWorldKt"
For me it worked after I installed the correct JDK. I first had JDK 11 but the tutorial I did was with JDK 8 so after I installed this and set it in the "installed JREs" options it found the main class without having any "mainClassName" or any other option in the build.gradle file.
For me, it worked in a fresh eclipse workspace. Possibly, the Kotlin eclipse plugin is not playing well with other plugins (in my case, PyDev).
I'm creating a Kotlin Application with JavaFX and I had this issue until I went to:
Run > Run Configurations > Java Application > Common
I unticked "Allocate console" and it fixed the issue.
I am trying to create an OSGI bundle having selenium firefox web driver. I used the same dependency in maven project and it all worked fine. But when i am creating bundle, compilation gives no issues. But on installing bundle, there are some internal dependencies which can not be resolved. There is a property in maven bundle plugin
embed-transitivy. I set it to true which solves almost all the internal dependencies of firefox-webdriver. Still some could not be resolved.
Error:
net.sf.cglib.asm.util -- Cannot be resolved
org.apache.avalon.framework.logger -- Cannot be resolved
org.apache.log -- Cannot be resolved
org.apache.log4j from log4j.over.slf4j (4)
org.apache.tools.ant -- Cannot be resolved
org.apache.tools.ant.types -- Cannot be resolved
org.codehaus.aspectwerkz.hook -- Cannot be resolved
sun.misc -- Cannot be resolved
Moreover, when I am searching for net.sf.cglib.asm.util in cglib-nodep.2.1_3.jar there is no such class. Internally firefox-driver using cglib-nodep.2.1_3.jar. I guess there is some problem with the version 2.1_3. I dont know How OSGI resolves this version name.
Can somebody please figure out what could be an issue. and where do I find the class net.sf.cglib.asm.util ?
PS: I am using 2.25.0 version of firefox-driver which internally depends upon cglib and fetches 2.1_3 version of it.
There is a different problem all together I think. You might like to have a look at this.
http://code.google.com/p/google-guice/issues/detail?id=208
There is the same problem you have faced. So read that. It might help.
Sounds like you are facing the problem described here http://spring.io/blog/2009/01/19/exposing-the-boot-classpath-in-osgi/ and here http://blog.meschberger.ch/2008/10/osgi-bundles-require-classes-from.html