Cordova run does not build plugin classes - java

I am getting crazy here: it has been 3 hours that I try to understand why InAppBrowser does not work. I have removed the platforms/android folder completely, added again the plugin via the CLI only to see in adb logcat that the InAppBrowser plugin is not found. Indeed, I do not see the classes generated in the platforms/android/ant/build. On the computer of my colleague, everything is fine, the classes are generated and the plugin works. We have basically the same setup and I do not see why those classes are not generated. I am not an expert in Ant builds.
Can someone point me to the right direction ?
[EDIT] More information:
To install the plugin, I did as suggested in https://github.com/apache/cordova-plugin-inappbrowser/blob/master/doc/index.md:
cordova plugin add org.apache.cordova.inappbrowser
I did run cordova build.

I suspect your /plugins/android.json got somehow corrupted.
The simpliest I could recommend you is to remove the /plugins folder and re-add all the plugins you need in your project.

Related

issue while installing FindBugs in NetBeans 8-2 [duplicate]

I am getting below error while installing Findbugs into Netbeans 8.2:
"There were some problems while storing Establishing a connection …
Cause: Cannot resolve external reference to m2:/org:ow2:asm:asm-debug-all:5.0.2:jar"
I have tried uninstalling NetBeans 8.2 and removing anything associated with the installation to get a fresh install with no success there, and I have tried the latest version of NetBeans 11.3 which I found does not have Findbugs available. I need the plugin for a school project and no one there has been able to help me with this issue either. Any help would be greatly appreciated.
I am using a Windows 10 PC.
Thank you.
The reason of the error
The error happens because when you download the plugin, NetBeans also tries to download additional dependencies. The links where to download the jars from are written inside the nbm package.
For example, one of the dependencies is asm-debug-all-5.0.2.jar, and the link is:
http://repo1.maven.org/maven2/org/ow2/asm/asm-debug-all/5.0.2/asm-debug-all-5.0.2.jar.
The maven repository is no longer accessible using the HTTP link. You can read more about it here.
So basically, you could not install the plugin because the plugin is outdated and contains invalid links for downloading dependencies from maven repo.
Before solving the issue, consider using SpotBug instead because the FindBug is outdated and is no longer actively maintained, for more information, please, see here in another answer. Also, keep in mind that it works only with JDK8.
How to solve it?
To solve the issue, you need to fiddle around a bit with plugins.
You need two plugins FindBug Libs (org-netbeans-libs-findbugs.nbm) and FindBug Integration (org-netbeans-modules-findbugs.nbm). Download them using thees links:
https://updates.netbeans.org/netbeans/updates/8.2/uc/final/certified/82/extra/org-netbeans-modules-findbugs.nbm
https://updates.netbeans.org/netbeans/updates/8.2/uc/final/certified/82/extra/org-netbeans-libs-findbugs.nbm
Unzip org-netbeans-libs-findbugs.nbm manually as if it is a simple zip file.
Edit the files in org-netbeans-libs-findbugs\netbeans\modules\ext extracted folder. In every file, you need to change the link from http to https.
Edit manifest file org-netbeans-libs-findbugs\META-INF\MANIFEST.MF. You need to remove all lines that contain CRS checksum. After editing it should contains only these lines:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.2
Created-By: 1.8.0_45-b14 (Oracle Corporation)
Remover other two files in org-netbeans-libs-findbugs\META-INF (ORACLE_C.RSA and ORACLE_C.SF).
Zip it again.
After that, the file is ready for manually installing into Net Beans. Alternatively, you can download the file from here. I have already modified the plugin using the steps.
How to install and use it?
Got to Windows -> Plugins -> Downloaded -> Add Plugins
Manually add the modified org-netbeans-libs-findbugs.nbm file and click install.
Then add org-netbeans-modules-findbugs.nbm and click install.
When installing, it shows that it downloads the plugin, but actually, it downloads only dependencies. It can take some time.
After that, select your project in the project tree, make sure it was compiled before. Got to Source -> Inspect, choose FindBus in the Configuration.
After you click to inspect your report will be ready.
It works both on NetBeans 11.3 and 8.2. Make sure you are using JDK8 with NetBeans. I'm not sure it will work with the newest versions of JDK.
Here is an example with running it on 11.3 using JDK8 on some NetBeans module:

Java proposals not showing for dependencies

General Java question here / a little maven-y also. I downloaded the parent pom from a repository and did a mvn install to get all of the dependencies, but now when I am writing code, specifically in the example below, I might write something like: conn. and expect the proposals to show up, but they are not. Now say I were to a go step further (since I have it in front of me) and say conn.tableOperations(). I would expect theses proposals to show up, but like I said they are not. Here is a pic of what I am talking about if that explanation didnt suffice:
If I were to type String bla; then bla. all of the proposals would show up for that? I know it must / is related to the dependencies but I have never had this problem before. I did a bit of digging and found that maybe a maven clean install with the proper parameters would help, but I have zero clue what they would be. This is what I am referring to in this regard.
Any ideas? Thanks.
I think you are confused about Maven and Eclipse interaction.
I downloaded the parent pom from a repository and did a mvn install to
get all of the dependencies...
That is your first mistake. mvn install is not what you think it is.
You need to start by installing Maven integration in Eclipse.
This is either already available depending on which package solution
you chose, or it is available in the Eclipse marketplace.
Next you need to create a new Maven project in Eclipse.
Lastly you need to specify a dependency on the jar in the m2e
plugin. This will automatically bring in all the necessary
dependencies into your project workspace.
Note the above link has full documentation, including a Getting Started tutorial.
Alright I solved my problem. I couldn't see the proposals because the project I was trying to edit was still inside of the parent project, which wasn't considered a Java project, hence why the Java proposals weren't showing up. I drilled down into the parent project to the project I was trying to edit, right clicked and clicked "Import as project". It keeps the project still under the parent project and edits are made to both, but now the inner project is considered a Java project. Everything works as expected now.

"java: package org.apache.cordova does not exist" when compliling Cordova in Android Studio

New to android dev world and am just getting started here, well trying to anyway. I've downloaded Cordova (2.8, might need to upgrade this), Java JDK (1.7), and the new Android Studio, the Andriod SDK, installed all the 4.x packages with that, and installed ant (1.9.2).
Everything seems to be working as far as that goes. Problem is when I can create a Cordova project, from the command line, load it up in Studio using the import feature, not tweaking anything, just accepting (as I read to do so on some blog out there) and everything seems to load ok and the project is there in Studio, until I try to make it. At this point, I get and error "java: package org.apache.cordova does not exist" This is followed by several other errors, which I feel may be related. I'm not nor am I trying to do anything fancy here, just get the stock up and running.
Anybody know what I'm missing? Do I need to copy a file somewhere or compile something extra? Or am I using the wrong version of something?
Thanks!
I found after hours of searching and trial and error (although mostly errors) I came to find that it was all due to missing the cordova-*.jar file. which needed to be built using the ant jar in the framework folder of my android cordova directory. This step had been majorly left out of a ton of documentation. Once built, I simply copied this into the 'libs' folder of my project and everything loaded up and ran, although I did get a warning about depreciated project from the compiler, creating an ant build and selecting 'external compiler' fixed this warning.
Android Studio uses Gradle project layout. This means main java files should be in /src/main/java. If Cordova generates different structure (it looks like it is old Ant structure) you need to add its source folders to build.gradle
android {
...
sourceSets {
main {
java {
include 'some/wanted/package/**'
include 'another/wanted/package/**'
exclude 'some/unwanted/package/**'
}
}
}
}
Here is where the file sits:

Eclipse plugin not working properly

I developed an Eclipse plugin that compiles and runs java code in German. The technique I am using is that I translate the code to English and pass it to Java Compiler and get the results back and print it in the console.
The problem is that the plugin works when I run the plugin from Inside Eclipse but when I install the plugin in Eclipse so that when I open Eclipse it already exists there and start to test if a real user uses my plugin and creates a new Java project and try to the compile button in my plugin it says [The chosen operation is not currently available] ![Here is the the way I run and it opens a new Eclipse application with the installed plugin ]
Any help please
the way you installed your plugin sounds a little weird to me. So at first please try to export your plugin via the Export Wizard.
(Select Export -> Deployable plugins and features from your projects context menu)
Export your project as jar file and copy it to the 'plugin' folder of your eclipse instance.
After that it might be helpful to debug your plugin on OSGI-Level as there might be a problem loading your plugin (at least the error description you have posted indicates that).
Run eclipse with -console -noExit -consoleLog flags to open an OSGI console for debugging. After that try running ss <your-plugin-name> to see what the state of your plugin is.
The output gives you the ID of your plugin and the state it currently has. If the state of your plugin is not ACTIVE try running start <your-plugin-id> to see whether it starts correctly. If there is a problem starting your plugin you should get a respective log message. Feel free to post it here in case you need further help.
Otherwise there are plenty of options what might cause your problems, so maybe its better to try the steps I have described above before getting into details.
If you want to run eclipse plug-in withput using Eclipse Application , then you need to make a Feature project.
Now if your algorithm has something to do with system Path , you must
check Unpack plug-in and you should read the resource accordingly.
Like PLatformUI.getWorkBC() etc..
No other eclipse plug-in (jar) should be inside plugins directory of eclipse of same name of your plug-in. Ensure for this.

IDEA JetBrains IntelliJ - Compile error on 'make' but fine when compiled using Maven and no errors reported by IntelliJ in the class file

So I have a maven module (module-A) in IntelliJ. I recently moved some classes from it into another new maven module (module-B) and added a dependency to it. Once I had done this I also modified the signature of a method of one of the moved classes (now in module-B).
I re-imported the poms so that IntelliJ would pick up the dependency changes and ensured all Java imports for the affected files were correct again. Now when I attempt to run my webapp (which depends on the two modules) I get a compile error in a class in module-A calling the modified method of the class in module-B.
The error message is basically saying that that method doesn't exist but believes the old method still exists! I click on the 'make' error and it takes me to the line in a class in module-A calling the modified method...the weird thing is, IntelliJ knows it is fine in the file. i.e. The method is not underlined in red like a compile error would normally be, but the class file name is :(
I compiled it from the command line using 'mvn install' (having also installed module-B) and it is all successful. I have deleted the classes directory in the target of both module-A and module-B and also invalidated IntelliJ's caches and restarted...still happening...any ideas?
I found out that this might help:
File -> Invalidate Caches
Maven Projects -> Reimport should help.
I spent a few hours on this same issue. All of the cleans in the world didn't help.
I deleted my out and target directory in my project and recompiled - that cleared it.
Edit: There is also a magic feature under the file menu: "Invalidate Caches / Restart" This fixes a bunch of "intellij is confused" problems.
Change "Java Compiler" setting in IDEA (User compiler javac in-process) to fix the problem.
Try to mvn clean your projects and mvn install your project B.
The maven integration with intelliJ is kind of buggy when you use the make command directly provided by Intellij. You should directly use the mvn commands, or start them from the maven panel.
I ran across a very similar problem that was driving me insane.
My code would compile fine with the ant task I normally run, but it would not build in IntelliJ, complaining about "Cannot Find Symbol blah blah"
Turns out, you can add "Excluded" files for the compiler. My file somehow got added to that list.
This list is located in File > Settings > Compiler > Excludes (IntelliJ 13)
Following steps should fix this problem :
delete .IntelliJIdea12 / .IdeaIC12 older under c:/user/.../
Invalidate Intelli's cache: File > Invalidate Caches.
This re-indexes your workspace on start-up and also clears your local history. Before you do this, commit or back up all your uncommitted changes.
Once your workspace is back after indexing, do a maven clean install.
when the build is successful, click on Maven Re-imports
This worked for me, I think it should work for others too with a similar problem.
So just stated it up this morning and it's all working!
Last night what I did do was open a new project (intelliJ project) from module-A's and module-B's parent pom and successfully got it to build, possibly doing that and then opening my original project again fixed it somehow...very annoying though
The behavior I see is similar to the one described by the original author.
Error markers show up on the right side of the editor in Intellij 14 and less so in 13.
This happens also if using Scala instead of Java and using SBT instead of Maven.
Also noticed this occurs after the second project is loaded. The first is always fine.
(After much trial and error) Figured it might be caused by Intellij's internal caches becoming somehow corrupt. "Invalidate caches" worked sometime and sometimes did not.
I work with a number of projects using Play! Framework and they use different versions of Scala and lots of dependencies.
I hypothesized the caches become corrupt because the internal key Intellij uses is not good enough to handle situations when the same class, loaded multiple times in different jars, has different signatures, and this results in the editor errors while external builds work fine.
Then the "Changing Ivy Cache Location for sbt projects in IntelliJ IDEA?" post gave the idea to segregate the ivy cache SBT and Intellij use in the hope that the ivy path is part of the internal cache key.
Paul Phillips of TypeSafe provide the "SBT extras" tooling and here I found a way to instruct SBT to use a project based ivy home, cache and SBT boot:
https: //raw.githubusercontent.com/paulp/sbt-extras/master/sbt
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
How to configure Intellij
: see http://content.screencast.com/users/SemanticBeeng/folders/Snagit/media/ec8ec491-6d0c-4691-9598-916a63ba65ef/12.02.2014-08.59.png
Then did the same for the external SBT build to work in sync
: see http://content.screencast.com/users/SemanticBeeng/folders/Snagit/media/dcb287c4-200f-47f3-a937-42865675a22b/12.02.2014-09.01.png
Finally got rid of the user home based .ivy2 and all the contents.
To be sure Intellij does not use this folder I made it readonly.
This was a mistake. Intellij seems to silently fail resolve dependencies if you do this.
This solved the errors and believe they will not come back. :-)
If Intellij guys hear this: please test your releases (Scala, SBT, editor) with all the Play Framework templates from TypeSafe. The problem becomes apparent quickly this way.
I just had a similar issue that was driving me insane. I had done all the other things mentioned in the answers above because I have used Intellij forever, but none worked. In the end I found out that in the maven projects portion of Intellij, one of my modules had been marked "ignore" a simple unignore command from the context menu did the trick.
In my case, I had manually marked a directory as "Test Sources Root" but IDEA marked it on a parent Maven project. Unmarking it in File->Project structure...->Modules fixed the problem.
This could happen if you are using different version of java while building outside IntelljJ. My IntelliJ had java10 and I was using java8 while building at terminal. Changing java version to IntelliJ fixed this issue for me.
I had a very similar behavior. Running (Scala-)tests would always fail due to errors in unrelated java classes during the 'make' step.
It turned out, I had included a 'global' SDK library that collided with one of the dependencies from the project. A proper helpful error message only showed up after I deleted the 'make' step from the test.
I then deleted the duplicate library, re-added the make step to the test and everything is now working fine.
I ran into this problem today after upgrading from 12 to 13.
Later I fixed issue as I used the same name for Project and Module and looks Intellij allows this but cannot handle it correctly.
No idea why setting will impact the compilation, although there is no error in java editor. Should be a bug in version 13.
I was facing a similar issue after upgrading from IntelliJ 12 to 13. After multiple uninstalls and re-installs (of multiple intelliJ versions), numerous cleans and .m2 repository clearing, I finally figured out what my issue was.
In my intelliJ settings, the repositories mentioned in my main POM file could not be connected to. this was in turn due and alternate repository that was mentioned as a part of my pom file.
Once the POM was made to point to the correct repository, all my classes had their compilation issues resolved.
To check if your repositories are being connected to, go to File -> Settings -> Maven -> Repositories
Here, your indexed maven repositories should be connected to successfully. If they are not, then intelliJ will not be able to resolve most 3rd party and module dependencies.
I'm embarrassed to say, but we also had this problem, but it was due to a mistake in our package name.
When creating the packages for a new project I accidentally created a package called "org.package".
My project then had a directory structure like:
/src/main/java/org.package/
Which caused all sorts of havoc with IntilliJ.
Once the correct folder structure was created on the file system, IntelliJ worked great.
/src/main/java/org/package/
Note the difference in /org.package/ vs /org/package/
The fix was i made it javac instead of Ajc and i put 1.8 of course according to your jdk version.
for some reason when i invalidate and restart intellij it was set to be the default !
my version is
This happened to me...what fixed it was realising there was an extra main.iml file in the source directory. Deleting that instantly made the compile errors go away.
None of the above answers worked for me.
In my case, I had to finally create an explicit Maven Run Configuration for the module (with Command Line as "clean install") and then run it.
It is in Run > Edit Configurations
close the project
go-to the project folder and delete idea project file and .iws file
run mvn idea:idea
restart the project.
seems idea keeping the old project dependencies without cleaning even though we run file -> invalidate caches
Setting the proper Java SDK solves the issue
Right click on the project and select "Open Module Settings"
Check if you have the right Java SDK under platform settings
Check the SDK under Modules
Rebuild the project from "Build" menu
Delete the installation directory.
Remove the following directories:
~/.config/JetBrains/
~/.cache/JetBrains/
~/.local/share/JetBrains/
This will remove each and every configuration plus installation of jetbrains tools, be it IDEA, goland,etc.
Now install everything from scratch.
That's the only way it worked for me

Categories