I am trying to access interface from other module in android studio where my project structure looks like this
projectRoot-folder
app-main-module //this is main app which i run
com.mypackage.files
MyClass.java
build.gradle
other-library-module //this is library module which i added
com.package.files
InterfaceFile.java
build.gradle
build.gradle
settings.gradle
I am implementing interface for MyClass.java and that is working fine with no compile errors,but when i press run it is giving the following error's can anyone explain why it is so?, any help is appreciated thank you.
Error:(5, 32) error: cannot find symbol class InterfaceFile
Error:(10, 52) error: cannot find symbol class InterfaceFile
Error:(11, 5) error: method does not override or implement a method from a supertype
Error:(16, 5) error: method does not override or implement a method from a supertype
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
You have to add in your file settings.gradle this lines:
include ':module2'
project(':module2').projectDir = new File(settingsDir, '../Project 2/Module2')
Then you have to add in your builde.gradle (Module: app) in the dependencies tree, this line:
compile project(':module2')
or go into the Project Structure > app > Dependencies, click on Add, choose 3 Module Dependencies and select your module
Related
I'm fairly new to Gradle and I have a project which uses JPA modelgen. Said project depends on another project which is our own and the annotation processor can't find this dependency. It has no issues resolving external dependencies.
Relevant part of my build.gradle:
dependencies {
compile project(":my-other-project")
//Omitted irrelevant stuff
annotationProcessor 'org.hibernate:hibernate-jpamodelgen:5.4.18.Final'
}
Now I'm probably missing something super simple, but I can't find the cause of this error, which occurs when building:
symbol: class [my-other-class]
location: class [my-class]
C:\[path]\:94: error: cannot find symbol
DataProvider<[my-other-class], String> createDataProvider([my-class] service) {
^
Now when I start the application, it compiles and runs, just without layouting (this is a Vaadin Java application)
I am using IntelliJ.
I have added the JAR - https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client/2.0-m04
To my project,
{{ import org.glassfish.jersey.client.JerseyClientBuilder; }}
despite this I still get a compile error .
Error:(3, 35) java: cannot find symbol
symbol: class JerseyClientBuilder
location: package org.glassfish.jersey.client
I did have a lot of errors due to missing JARS , but I just found them on the web and added them to the project under project structure and that sorted all the errors except for the jersey Client Builder ...
I have a Intellij plugin project that I can successfully build without using the PsiMethod class. I've generated this project using this intellij plugin guide
As soon as I add in code using PsiMethod class
(from the Intellij SDK code_samples directory)
The intellisense cannot find any GOTO information for the class.
I can then switch my project settings module from JAVA_1.8.0 to
by adding it into the platform settings SDKs:
This now adds intellisense, and gives me the ability to navigate to the PsiMethod class by CMD+click.
However, If I try and run my "plugin" gradle configratuion. it halts with an error running :runIde.
Running compileJava command from bash I get:
$ ./gradlew compileJava
> Task :compileJava FAILED
/Users/cody/IdeaProjects/plugintest/src/main/java/com/plugintest/TestClass.java:104: error: cannot find symbol
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
^
symbol: class PsiMethod
location: class ParticleContainerManager
/Users/cody/IdeaProjects/plugintest/src/main/java/com/plugintest/TestClass.java:104: error: cannot find symbol
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
^
symbol: class PsiMethod
location: class ParticleContainerManager
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
The gradle source sets in intellij are as follows:
And when I CMD+Click the PsiMethod class, it shows the following JAR source:
This source is in the following parent folder:
How can I add this source into my gradle configuration? shouldn't it be autodetecting what my projects intellisense is tapping into?
Do I need to change something in the gradle.* files inside the project directory?
EDIT:
Using Yann's Answer:
I've added the following line to my build.gradle file:
intellij {
version '2019.2'
plugins 'java'
}
and it works!
Please make sure to add Java plugin as separate dependency. This is now necessary starting with 2019.2: https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/
I have a Spring application that i did not started to build, these dudes made it old school way without maven or gradle support in eclipse.
I want to work on it in IntelliJ Idea, importing the project gives me the following errors:
Idea Event Log:
12:13:36 PM Unknown Natures Detected
Imported projects contain unknown natures:
org.eclipse.wst.common.modulecore.ModuleCoreNature
org.eclipse.wst.jsdt.core.jsNature
org.eclipse.jem.workbench.JavaEMFNature
org.eclipse.wst.common.project.facet.core.nature
Some settings may be lost after import.
Also when trying to build:
/home/.../src/com/.../controller/servlet/VideoServlet.java
Error:(7, 32) java: package javax.servlet.annotation does not exist
Error:(13, 2) java: cannot find symbol
symbol: class WebServlet
/home/.../src/com/.../service/CustomUserDetailsService.java
Warning:(10, 51) java: org.springframework.security.core.authority.GrantedAuthorityImpl in org.springframework.security.core.authority has been deprecated
/home/ldurazo/git/arcofi/arcofi/src/com/arcofi/controller/FileDownloadController.java
Error:(35, 40) java: cannot find symbol
symbol: method getServletContext()
location: variable request of type javax.servlet.http.HttpServletRequest
I have the library servlet-api2.3.jar
And in the project structure i have the following problems
Module project : invalid item 'org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0' in the dependencies list
Module project : invalid item 'org.eclipse.jst.j2ee.internal.web.container' in the dependencies list
Module project : invalid item 'org.eclipse.jst.j2ee.internal.module.container' in the dependencies list
And last, in project structure too:
Unknown facet type: 'Spring'
Unknow facet type 'Web'
I am using IntelliJ Idea 14 and Eclipse Luna
I'm trying to import ActionBarSherlock (ABS) into my Android app using Gradle, but unfortunately, when building I get a list of errors saying:
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:248: error: Attribute "titleTextStyle" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:250: error: Attribute "subtitleTextStyle" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:256: error: Attribute "divider" has already been defined
/Users/kramer65/dev/repos/android-official/OurPackage/build/res/all/debug/values/values.xml:258: error: Attribute "background" has already been defined
[etc. etc.]
* What went wrong:
Execution failed for task ':processDebugResources'.
> Could not call IncrementalTask.taskAction() on task ':processDebugResources'
I'm trying to import ABS using the following in build.gradle:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services:4.0.30'
instrumentTestCompile(files('libs/espresso-1.0-SNAPSHOT-bundled.jar'))
}
and in my settings.gradle I've got the following line:
include ':OurPackage', ':Libraries:ActionBarSherlock'
Does anybody know what I'm doing wrong? All tips are welcome!
The same attributes titleTextStyle, subtitleTextStyle, divider, background are defined in 2 different libraries.
The 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar' and the support library 'com.android.support:support-v4:18.0.+' which introduced the v7 appcompat library can't work together.