I have been trying for the past day to get at least google's sample code working. Every single of their sample code have dependencies issues or errors within the code (even they have stated in quick start thats a copy/pasta code to test the api - never works). I have installed all of the dependencies, I pointed the jar file to the missing imports, but no success in that..
Can anyone tell me where is the problem when my jar is in dependencies but it never finds it?
I wish they had a normal way of taking json data - via url, but they disabled this.
Related
I was just creating a new project and doing creating some JWT Authentication.
I was writing my code and it worked as intended. Suddenly after having created a bunch of code, IntelliJ suggested I would do a Maven reload. I don't per se know why, but I did it as I thought there would be a handy change instead of what happened now.
Now all my imports are invalid, not recognized whilst (I think) nothing else changed.
I cannot help but think there is a simple fix for this problem, but I cannot find it anywhere.
I'll include two screenshots of my situation in an imgur link, a before and an after.
Imgur Screenshots
I am using these two libraries in my project:
https://github.com/HemendraGangwar/VideoTrimmingLikeWhatsapp
https://github.com/fishwjy/VideoCompressor
Both libraries are imported locally to my project (i.e. copied them and added them to the project)
Both libraries work fine when used separately, but when I use them together I get some errors of type Program type already present which I solved by deleting the file isoparser-1.0.6.jar from the second library, because I noticed that the two libraries use the same library 'com.googlecode.mp4parser:isoparser' but with different versions: 1.1.21 for the first one and 1.0.6 for the second one.
When using only the old library, I get this code:
error: cannot find symbol class FileDataSourceViaHeapImpl
It is working now, but the problem the output video (after compression) does not have sound on it. How can I solve this?
Here is the code I am using for compressing the video (after trimming):
VideoController.getInstance().convertVideo(tmpFile.toString(), dstFile.toString(),
VideoController.COMPRESS_QUALITY_MEDIUM, null);
EDIT1
Summering the scenarios here with the same video:
VideoTrimmingLikeWhatsapp with verion 1.1.21 => works
VideoTrimmingLikeWhatsapp with verion 1.0.6 => does not works (compile error of missing classes)
VideoCompressor with 1.1.21 => does not work (no sound)
VideoCompressor with 1.0.6 => work
I tried a lot of things, and I am loosing tracks here. I also tried using SiliCompressor which seems also using version 1.0.6 of mp4isoparser, and the same problem is happening, output video has no sound. I posted an issue here a few days ago, but I don't think they will address this any time soon.
I also submitted here.
I tried downloading the mp4parser version 1.1.21 from here, and tried to import it locally so I can change the package names, but I couldn't because it using Maven not Gradle. The old version is a jar file, and I need to decompile it so I can mess with it. Can I do that?
I also tried using ffmpeg libraries, but all of them work very slowly compared to mp4isoparser
EDIT 2
The author of SiliCompressor has replied to the here I opened, he says that the problem should be solved by now. For the moment I am unable to verify it, as I no longer work on that project. If any one can confirm it, just tell me to add the answer to this topic.
This combination worked for me:
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.3'
implementation ('com.googlecode.mp4parser:isoparser:1.0.6') {
exclude group: 'org.aspectj', module: 'aspectjrt'
}
Credit to: https://github.com/AndreyAsadchy
https://github.com/Tourenathan-G5organisation/SiliCompressor/issues/141#issuecomment-625308490
If the problem is really caused by the libraries version it is going to be tough to solve.
First I'd double check that. You said you tested the libs separately and that they worked, but, have you tried using the output of 'VideoTrimmingLikeWhatsapp' as input of 'VideoCompressor'?
I'm suspecting that 'VideoCompressor' does weird things with audio in some circumstances, somebody in this issues says there is no audio:
https://github.com/fishwjy/VideoCompressor/issues/1
If you get a video without sound using 'VideoCompressor' with his own version of 'isoparser' you can discard libraries version as the source of the problem.
Then, I think, you can: replace 'VideoCompressor': it seems to rely on Android libraries to perform the compression, you may implement that yourself, or you could find another library for doing the job. Or you can fix 'VideoCompressor': you could report the problem to the author or you could try to fix it yourself.
If you confirm the problem is the versions conflict: Then I can think several options, but none of them is easy:
You can try playing with classloaders and force each library to use their correct version of 'isoparser'. This alone can be difficult to do, besides that it can be very problematic in Android.
You can patch one version of isoparser, renaming package names (for example to com.googlecode.mp4parser_old ) so two versions of them can coexist, you should also patch the client library for using the new package names. This is very ugly but seems doable.
You can try to update 'VideoCompressor' to be compatible with isoparser-1.1.21. You could also ask the author to do it.
Again, you could replace 'VideoCompressor' (or may be 'VideoTrimmingLikeWhatsapp')
I'm aware this is not the definitive answer but I hope it helps you a little.
It's too late but i send this solution to be useful for others.
Yes, the problem is about version conflicts between the two libraries.
Solution:
Don't touch video compressor library at all.
Downgrade the "isoparser" dependency of video trimmer to the same version (1.0.6) with video compressor library dependency "isoparser".
Remove the following line from TrimVideoUtils.java file:
import com.googlecode.mp4parser.FileDataSourceViaHeapImpl;
Then change the following line:
Movie movie = MovieCreator.build(new FileDataSourceViaHeapImpl(src.getAbsolutePath()));
To
Movie movie = MovieCreator.build(src.getAbsolutePath());
It's done.
NOTE: Be careful about large files. Because this solution doesn't use memory mapping.
Basic background data: Windows 7, Netbeans 8.0.2, LWJGL 2.9.3, Slick Util.
The rest of the code is my own.
So, periodically, I was having what I thought was a bug, that caused my program to run within the IDE, but would fail when I used "Clean and Build" on the project.
Today, when it happened again, I decided to get to the bottom of it. So, taking a copy of the whole project folder, that was working and otherwise identical, and replacing 1 file at a time, and testing it, I was able to narrow it down to the /nbproject/project.properties file.
Every other file could be replaced and the problem persisted. Replace ONLY this file, and the problem went away. So then I loaded up both files and compared them side by side (using the Netbeans "Diff to..." feature) and narrowed it down to the following lines:
javac.classpath=\
${libs.LWJGL-2.9.3.classpath}:\
${libs.0-Slick_Util.classpath}:\
${libs.0-Loaders_v03.classpath}:\
${libs.0-Text2D_v03.classpath}:\
${libs.0-Foundation_v04.classpath}:\
${libs.0-Abstracts_v04.classpath}
Now this code, looks like it is telling the compiler the ORDER in which the libraries should be loaded (I may be wrong).
With that in mind, I decided to test it. I copied this block from the working file, to the non-working file, and it worked just fine. The working code btw is this:
javac.classpath=\
${libs.LWJGL-2.9.3.classpath}:\
${libs.0-Slick_Util.classpath}:\
${libs.0-Foundation_v04.classpath}:\
${libs.0-Abstracts_v04.classpath}:\
${libs.0-Loaders_v03.classpath}:\
${libs.0-Text2D_v03.classpath}
The only differences, you may notice, is the ORDER. Continuing my test, I went into the non-working project's Library properties page, and simply re-ordered the libraries to match the working list. PROBLEM WENT AWAY! If I simply moved the Foundation and Abstracts libraries down in the list, the PROBLEM CAME BACK!
I must have tried a dozen different order combinations, and got about 2/3 that failed, and 1/3 that worked. The ones that worked all involved Foundation and/or Abstracts to be near the top.
Why is this happening? How can I know what order my libraries need to be loaded to avoid the error?
The error btw is this:
F:\Dropbox\2-Documents\4-Java Programming\Library\0-LoadingScreen_v04-Copy\src\A_Library\Test_LoadingScreen.java:94: error: cannot find symbol
Lib_Foundation .setConfigLocation(configLocation);
symbol: method setConfigLocation(String)
location: class Lib_Foundation
Any information that can help me avoid this problem in the future will be appreciated.
It would appear that either “Loaders_v03” or “Text2D_v03” contains its own version of Foundation, including an incompatible Lib_Foundation class. A classpath is searched in order, so your current solution—reordering javac.classpath—will always work, assuming NetBeans doesn’t mess with it the next time you make any change to your project.
Whether that will break Loaders and Text2D depends upon how well Foundation adheres to object-oriented design: public classes and their public members are never supposed to be changed or removed in successive versions. (That is why 20-year-old code written for Java 1.1 will still compile in Java 8.)
I am getting an error on an import statement that I am using in order to try and implement Play Games with my app.
-The import com.google.android.gms.games.GamesClient cannot be resolved
I have BaseGameUtils referecncing google-play-services_lib, and my project references BaseGameUtils as a library.
It's my understanding that GameClient was to have been deprecated as of February 7, 2014 but when looking at Google's sample code (e.g. ButtonClicker) it still uses this import and some of the method calls from the import.
I got the code I am using from Google's GitHub sample app repository for the ButtonClicker2000, some of that code has been recycled and used in the program I'm having errors with as well.
This is all the info I can think to provide, if anything more would help please let me know.
I was struggling with the ButtonClicker2000 example for a couple days and I was having the same problem as yours.
I think the problem in the sample code is having some lines being not updated. If you look at that page, you can easily see that the updated versions of those lines are lying there. However the codes in GitHub page are not updated completely.
Because GamesClient class is removed permanently, those statements
GamesClient.EXTRA_PLAYERS
GamesClient.EXTRA_MIN_AUTOMATCH_PLAYERS
GamesClient.EXTRA_MAX_AUTOMATCH_PLAYERS
GamesClient.EXTRA_INVITATION
GamesClient.STATUS_OK
must be replaced with
Games.EXTRA_PLAYERS_IDS
Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_INVITATION
GamesStatusCodes.STATUS_OK
Also that line can be removed:
import com.google.android.gms.games.GamesClient;
There is no need for importing GoogleApiClient because it is already imported in GameHelper.java.
After changing these lines manually and importing Multiplayer and GamesStatusCodes classes, I was successful to compile the code. I hope that solves your problem as well.
I've been trying to get a basic project from the samples from Google running for a few hours now. I've followed every step so far and not really changed anything from what it's told me but after importing all the libraries and pasting the default code the program is complaining.
Description Resource Path Location Type
AccessTokenResponse cannot be resolved to a type MainActivity.java line 63 Java Problem
Some others are reported missing like. GoogleAccessProtectedResource, GoogleAuthorizationCodeGrant, GoogleAuthorizationRequestUrl.
From the default code of
// Step 1: Authorize -->
String authorizationUrl = new GoogleAuthorizationRequestUrl(clientId, redirectUrl, scope)
.build();
The fact this is not working is obviously leading to assume it's something to do with oauth2.
I'm pretty new to fiddling around with Android and Java, but after reading around I did manually import the libraries via right clicking > properties > java build path.
I've imported all the ones it said to import and cannot understand why it is erroring on practically the first step.
This is what I've imported.
Libraries:
All I want to do is view a public calendar in the Android Application. Been so much bother to get this API working
The code that I'm looking at for setting this up is found here
Thanks!
Hi I am facing the same issue with other classes of the client library, particularly with the GoogleAccessProtectedResource class.
From what I found out GoogleAuthorizationRequestUrl is not being used any more in the latest versions instead of that you should try to use GoogleAuthorizationCodeRequestUrl which is found in the following package
com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;