java: package does not exist error only after build - java

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.

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/

The import org.hibernate.validator.ClassValidator cannot be resolved and The import org.hibernate.validator.InvalidValue cannot be resolved

After migrating to the hibernate-annotations:3.5.6-Final jar, I'm trying to use the ClassValidator class.
But the import org.hibernate.validator.ClassValidator<User.class> is not getting resolved.
I also have the compatible dependencies org.hibernate.hibernate-annotations:3.5.6-Final and org.hibernate.hibernate-validator:5.1.3.Final
before migrating to the hibernate-annotations:3.5.6-Final jar, there were no issues with the ClassValidator<User.class>
Earlier I had the dependencies org.hibernate.hibernate-annotations:3.2.0.GA and
org.hibernate.hibernate-validator:5.1.3.Final, it was working well
I am not understanding the issue. How do I resolve the errors with hibernate-annotations:3.5.6-Final and hibernate-validator:5.1.3.Final, which are the suggested dependency jar in my demo project?
Please help me with this

Android Studio, Error: package does not exist

I was suffering form this over couple weeks, and it is killing me.
I am working on an android project in Android studio. I imported Haibison lockpattern as module to this projects.
in "settings.gradle" i add
include ':androidlockpattern'
in "build.gradle" i add
dependencies {
compile project(':androidlockpattern')
...
}
When I run the project, which print errors
"Error: package Haibison.android.lockpattern.util" does not exist.
I checked thousands times, the package is just right there, and when I import the package in my code:
import haibison.android.lockpattern.LockPatternActivity;
import haibison.android.lockpattern.util.AlpSettings
It just looks fine...
Plz help.
Try using this in your gradle project:
compile 'haibison.android:underdogs:+
Hope this helps!

How to search unresolved libraries in Intellij IDEA or Android Studio?

I'm trying to port Apache Flink to Android. One of the biggest problem is that some java tools doesn't exist for Android, but these conflict are not detected at compile time and the errors (NoClassDefFoundError excpetion) are detected only at runtime.
For example, Java's ManagementFactory doesn't exists for android, BUT no compile error is thrown even if in this class there are unresolved symbols/libraries, in particular:
import javax.management.MBeanServer;
import java.lang.management.BufferPoolMXBean;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage;
Now, I included the Flink's jars (flink-clients, flink-java, flink-runtime and flink-streaming) in my Android Studio project and I would like to search all these kind of unresolved dependencies to avoid these kind of exception at runtime. There is any Android Studio tool for this purpose?
I think including jar dependencies in the project will not make Android Studio and a compiler to search for missing classes in already built jars. Try to include src of flink into your project. I tried that and I had all unresolved imports being red.

Importing JTransforms library

I downloaded and compiled JTransforms-3.0 into my project and I can see it in the hierarchy here:
I'm running into issues on when I try to import it.
import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D;
It says it cannot resolve the symbol "edu" and I can get an error saying that the package doesn't exist. I'm using android studio and I have the libraries in my gradle file under the dependencies. Can anyone help? Thanks.
I don't know if you solve the problem still but I had to go through the same path as well. I ended up going to the Jtransform's GitHub page and downloading the "JTransforms-3.1-with-dependencies.jar" file. Placing it in the "libs" folder, right click "Add as a library" and works perfectly! :)
JTransform's github page
It should be imported like this:
dependencies {
...
implementation 'com.github.wendykierp:JTransforms:3.1'
}

Categories

Resources