com.google.api.client.extensions.java6 cannot be resolved - java

I'm trying to follow the tutorials for using google calendar api in here
https://developers.google.com/google-apps/calendar/quickstart/java
I tried it in eclipse but I have errors in
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
The import com.google.api.client.extensions.java6 cannot be resolved
where it says they cannot be resolved and a
The declared package "" does not match the expected package
"main.java"
in the first line
I think the problem lies in the structure of my files but I have no idea how to structure it , I installed gradle plugin as pre-requisite of using google calendar api stated in the link but I'm not sure how to add in build.gradle so I just add a new file and name it build.gradle

I solved it by changing JDK compliance to 1.7 in project properties > java compiler

Related

Android Studio import com.google.android.vending.expansion.zipfile.ZipResourceFile; does not exist

I am trying to setup the apk expansion setup. I added the SampleDownloaderActivity.java but I am getting these errors once I rebuild the project
import com.google.android.vending.expansion.zipfile.ZipResourceFile; does not exist
import com.google.android.vending.expansion.zipfile.ZipResourceFile.ZipEntryRO; does not exist
What is the alternative to correct this?
you have to include the expansion library separately as the code dependency, you can get the relevant code at location <sdk>/extras/google/google_market_apk_expansion/zip_file/

Encountering a Problem in IntelliJ which only accepts Wildcard Imports of java packages instead of specific Classes from java packages

Information about my Project:
Gradle Version 6.8.3
Lombok Version 1.18.18
IDE Version 2020.3
My JAVA_HOME Path in the Windows environment variables is set to the newest Java JDK (15.0.2). The Project Language in the Project Structure Path is also set to Java 15.
I am currently using IntelliJ version 2020.3 and since a few days I have the following Problem.
When I want to import specific Classes or Interfaces from the java package e.g java.time.LocalDate. IntelliJ marks this import as an unused import Unused Import java.time.LocalDate
After I replace the LocalDate with an Wildcard * the Message is gone java.time.*
In the next Step I did the same with another Class I want to import. This time I used the java.util.Set import. The same message occurred after I wrote Set<TestClass> foo;. Cannot resolve Symbol 'Set'
When I replaced the java.util.Set with java.util.* the Message disappeared. Wildcard import for java.util
I got this Problem everytime I want to import a specific Class from the Java JDK libraries. When I import libraries from the Gradle Dependencies everythings works fine. So this Problem only occurs on Java libraries.
I Already tried the following Steps to solve the Problem:
import Project with IntelliJ VCS
Checked if there are any incorrect settings in Project structure
File -> Invalidate Caches/Restart
Project Structure -> Project SDK and added the same Java JDK again
Ctrl + Shift + A and Restored default Settings
Code Sample:
import java.time.LocalDate;
import java.util.*;
import lombok.Getter;
import lombok.Builder;
#Builder
#Getter
public class TestClass {
private LocalDate testDate;
private Set<TestClass> foo;
}
After Installing Eclipse and getting the same Error Reports like in IntelliJ. I reinstalled jdk 15.0.2. I reopened the project again in IntelliJ and everything worked fine. IntelliJ recommend imports when I used java.util classes. So I will close this question now. Thank you guys very much for trying to help me with this problem. In the end it was something much easier which fixed the problem.

java: package does not exist error only after build

I'm trying to add the JCodec library to my android studio project. I followed the steps listed here. I import these four lines:
import org.jcodec.codecs.h264.H264Decoder;
import org.jcodec.common.AndroidUtil;
import org.jcodec.common.model.ColorSpace;
import org.jcodec.common.model.Picture;
I get no errors until I build my project. When I build the project, I get an error that each of the packages I tried to import don't exist. Does anyone know what the problem is?
Thanks!
I did not really understand how linked answer helped you to add library because it is for Eclipse and you are using Android Studio and Gradle.
In build.gradle you should add:
dependencies {
...
compile 'org.jcodec:jcodec:0.1.9'
...
}
I figured out my problem. The issue was that I added the library under libraries but it wasn't a jar file, it was an android project. What I did to solve the problem was adding it as a module and then adding the module as a dependency to my project.

Fitnesse importing util.ListUtility.list; is giving error

I am trying to
import static util.ListUtility.list; but it is giving error:
The import util.ListUtility cannot be resolved
I have fitnesse-standalone.jar in my path. I explored util package in jar. It seems that it is not any more. I downloaded latest version of fitnesse.Is it deprecated and not supported any more?
I also tried with fitnesse.util.ListUtility but no avail.
Thanks a lot.
It is resolved, as util.ListUtility.list; is not in fitnesse jar so I created the class in my source with same utility.

How come I can't import org.apache.commons.lang.StringUtils?

I added the common lang jar file in the classpath, but when I compile it says:
error: package org.apache.commons.lang does not exist
I tried to follow the steps described below:
http://oopbook.com/java-classpath-2/classpath-in-jcreator/
but I don't it doesn't work. Is it the editor that's not working properly or is it something else?
Between major versions 2 and 3 apache changed the package naming scheme on their classes from lang to lang3.
Notice on the download site that for version 2.6 you are downloading "commons-lang-2.6" and for version 3.3.2 you are downloading "commons-lang3-3.3.2".
Also, if you check out the current API doc you'll see the new naming structure.
All you need to do is update your import statement to match the new package structure and your compiler will be able resolve it correctly.

Categories

Resources