Message Boards

GoogleMapsPortlet

Naveena Madamanchi, modified 3 Years ago.

GoogleMapsPortlet

New Member Post: 1 Join Date: 2/24/21 Recent Posts

GoogleMapsPortletKeys cannot be resolved in to a variable?  I got this error in Eclipse code and could not deploy. Please give a solution. I need to build a  liferay MVC portlet for google maps

thumbnail
Andrew Jardine, modified 3 Years ago.

RE: GoogleMapsPortlet

Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts

Hi Naveena, 

Can you let me know which version of Liferay you are working with? Can you also include the build.gradle file for your MVC Portlet? (or pom file if you are using maven)

NOTE: if you are using Liferay 7.3 then the problem is likely due to the fact tha the class is not exported. The code for 7.3 looks like this --

package com.liferay.google.maps.web.internal.constants;

/**
 * @author Peter Fellwock
 */
public class GoogleMapsPortletKeys {

   public static final String GOOGLE_MAPS =
      "com_liferay_google_maps_web_portlet_GoogleMapsPortlet";

}

I think the general rule of thumb is, if you a class that has a package with the word internal in it then you can't really use it. You may get your code to compile and deploy but internal packages are not usually part of the Export-Package statement in the bnd descriptors so you won't have access to it at runtime. In this case, you might be forced to reference the string. For cases like this I would also recommend leaving a //TODO so you can easily find it again in the future when you can refector and then open a ticket with issues.liferay.com -- I think PortletKeys are normally exposed (i.e. not part of the internal group).