Android studio not giving suggestions from android-src.jar - java

I've downloaded android-src.jar and added it as a dependency to another project, but the code completion will only show the something like com.google.android.mms.pdu but no suggestions come after that for classes.
I've tried various dependencies, but none of them work. I've also tried tried Invalidate cache/Restart.
When I look through the library and view one of its classes, it's telling me it can't resolve symbols for classes that are clearly there.

These classes belong to Android framework, Platform classes can refer to other package private classes and you could not see its actual compiled class. Only symbols exposed by package designer could be seen.

Related

Java.lang.verifyError when adding module to Android project

I'm adding a library to my project (a .aar) by using "Open module settings > new > Import .JAR/.AAR Package".
It builds correctly an the app opens but, when the first class of that library is being instantiated it gives me a "Java.lang.verifyError" with that class.
Reading about it it seems the error happens when the library used to compile is not the same as the one used at runtime. But that seems a little abstract to me, where can a I check if that happens? How should I correct it?
Thanks
Maybe your library modules use two version types of dependencies of same library types. Like, say you're using library A and B. Then A use support design 27 and B use 28. Make it same. Few days ago we faced this error by Java which is totally new to us. We were using library modules and after multiple research we found it and solved using same type of versions. I can't guarantee, it will work to you though.

ScalarFunctionMultiPageEditor cannot be found by Plug-in

This is a weird situation. I am creating a plug-in which utilizes the HANA SQL Editor for Functions .hdbscalarfunction. It uses the dependency: com.sap.ndb.studio.sqlscript.function. Now, when I try accessing the class ScalarFunctionMultiPageEditor it is not working due to access restrictions. I then tried editing the access restrictions by allowing access to the specific package for that class. However, I get a NoClassDefFoundError.
I then noticed in the plugin.xml of the com.sap.ndb.studio.sqlscript.function is that the package for ScalarFunctionMultiPageEditor is not exported, so this is not visible to anyone.
Any ideas?
Thanks!
If the plugin does not export a package then you cannot use anything in the package. The Eclipse/OSGi classloaders enforce this and you can't work around it.

How to import android email source code into eclipse project?

I downloaded the android Email app source code [version 2.2] from here. I deleted the .classpath and .project file so that I could import an existing android project. Everything seems to have worked. However, I get quite a few recurring errors such as:
Attendees cannot be resolved to a
variable
android.provider.Calendar cannot be
resolved to a variable
Calendar cannot be resolved to a
variable
I have set the correct android version 2.2, what am I missing?
Thanks all for any help
I faced the same issue with Email. I fixed the issue, by adding the following jars into the build path and thus, all the errors were resolved.
../out/target/common/obj/APPS/Email_intermediates/classes.jar
../out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
But you need to make the Application build using the platform.
Many of the included applications cannot(or at least could not) be built with the SDK, as they depend(ed) on non-exported functionality that is only "visible" during the system build. I'm not sure if Email is still in this category, but it was in the cupcake days.
There are three potential workarounds. Best is to rewrite those parts of the application to instead use functionality which is exported in the SDK, and thus fairly stable.
Next up is to use reflection to pick up the missing pieces at runtime.
Last is to make do-nothing dummy classes for the needed non-public platform pieces, within your project. These are enough to let the program compile, and at runtime they get rejected due to name collisions with the hidden system functionality, so you end up utilizing the real classes rather than the dummies.
The proper thing to do is to build the application with the platform build system, rather than the SDK.

Strange problem with imports in Java Application

I'm building a plugin to extend the Eclipse BPEL Designer. That plugin is supposed to allow users to add meta information to certain model elements via EAnnotations. I already did the same thing for a BPMN model and it work just finde but when doing this for the BPEL designer I reveive rather strange exceptions.
The first I thing realized when trying to extend the BPEL Designer was that the designers plugins are defined in an unusual package structure. Instead of org.eclipse.bpel.xxx they have a "bin" in front of all package names. When I'm trying to import some of the designers classes I therefore have to refernce the bin path to make it work. However all the examples I was able to find just imported classes from the ordinary package structure.
Most of the time importing classes with the bin in front of the package name worked fine for me but every now and then I receive a strange error message. The message is in the form of: The type org.eclipse.bpel.xxx cannot be resolved. It is indirectly referenced from required .class files
It seems that Eclipse somehow can't find certain classes. I'm stuck at this point for over a week now and don't find any solution. From my point of view the problem has to be seen in the BPEL Designer plugins. Inside those plugins they reference classes in the form of org.eclipse.bpel.xxx but as I said when I reference those plugins their classes are inside packages with a "bin" in front of the normal package name. Could that be an explanation why certain classes can't be referenced by Eclipse and I get those strange error messages?
I'd appreciate any new ideas about that problem and hope that somwebody can give me an advice to solve that problem.
Cheers
Stefan
I already encountered in the past such troubles ...
I think there is a problem with the export/import of the BPEL Designer plugin.
How did you get this plugin ? Are you working with binary plugin or plugin imported as source in your SDk ?
Try to get again this plugin, may be an other version, or from an other source .. an update site.
I really think these "bin" packages/folders should not be here
Hope this can help ...

How do you figure out with Eclipse which JARs depend on which one?

I've trying to use Eclipse JDT AST parsing classes. After including the initial JAR, and sorting out a couple more dependencies, it is with 7+ JARs and I still having NoClassDefFoundError exceptions. This situation arises whenever I'm trying to test libraries with little or no documentation. Trial and error seems a very dumb (and annoying) approach to solve this problem.
Is there a way to automatically sort this out using Eclipse?
Update: Later I found that adding all the JARs you have, and using Ctrl-T (to view/locate types), lets you manually locate the JAR. That was the solution that Google provided so far. Is there a better way?
If you refer to this SO question Finding unused jars used in an eclipse project, you also have:
ClassPathHelper, which can quickly focus on unresolved classes:
It automatically identifies orphan jars, blocked (obscured) classes, and much more.
The only limit is dependencies that are not defined in classes, e.g. in dependency injection framework configuration files.
I have found setting up a workspace exclusively for browsing the eclipse source code incredibly useful. In this manner, you can use PDE tools like the Plug-in Spy, bundle dependency analysis, browsing the documentation, etc much like you would your own plugin projects. I found this article at Vogella a very useful guide.
If you know which bundle your desired class is you can generate the transitive closure of dependencies by creating a new OSGi launch configuration, with just the single bundle selected. By hitting the Add Required button, you can see all bundles necessary to use the one you're interested in.
Edit:
From your question it wasn't clear as to the environment you want to run the compiler in. If you're interested in an embeddable Java compiler to be run outside of an OSGi environment, may I suggest Janino.
You could use a dependency analyzer like:
JarAnalyzer
This will parse a directory full of Jars and give you an XML output dependency map, for which there are several tools for displaying in either graphical or text form.

Categories

Resources