Building FFmpeg for Android - android

I've spent almost a week on this now, trying to get FFmpeg "Angel"/"Happiness" to build for Android.
I've tried build scripts from all over the internet to no avail. I got closest was using this. As the author himself says the script doesn't work for newer versions of FFmpeg due to this bug, which has been dismissed on that ticket saying "I found a Makefile that does it." This was dis-heartening, being the only post on all of the vast Google world that was anywhere close to my problem.
So, question time:
Is there a way to get around the above bug? I'm trying to use the newest ffmpeg API, and "Love" is just giving me "undefined reference" errors while trying to use av_encode_video2(), and av_free_frame(). The code I was working on the lines of is at the ffmpeg git repo, under /doc/examples/decoding_encoding.c (the function starting on line 338).
Update: So they've done away with codec_names.sh in "Angel". Sorry didn't notice that before, but the problem persists in a different avatar now. With every build attempt the compiler throws a certain
start ndk-building...
/home/<user>/android-ndk/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries. Stop.
Say whatnow!?

Given the lack of any response at all, I'm assuming people who know their shit in this topic are really busy putting their skills to use with whatever they managed to compile. For the ones like me who scraped each corner of the web for an answer that makes any little sense, I have a.. more than decent workaround.
The Guardian Project, an awesome resource on github, has the perfect project set up for building an ffmpeg binary with all the settings of your choice. But just the one big problem of getting it to successfully build sans the "Unable to create executables" error.
So.. there's a way out there too. Less flexible, but it saves you from losing any more hair than I'm sure you (like me) already have. Head out here and profit.
From running the file command I noticed this binary was dynamically linked, that seemed weird, but it works.
Also, you'll have to run the chmod command before using it on the device (being a binary file and all). So pop it into your res/raw/ folder, load it up when needed and edit those videos like there's no tomorrow!

Related

How to edit the lib2cpp.so file of a unity build inside my Android Project

A third party created a unity project for me but they lost their project on their end. A guy had it on his laptop, never backed it up but he did send the integrated unity project for android. The only issue is that we need to change something inside it. So I have the android project, I just need the built unity's source code.
The same situation occurred with our IOS version, luckily Xcode had the Assembly-Csharp accessible and I could find the value I needed to change. The Android's Unity was built with il2cpp. I've managed to re-secure the assets using some tools I've found online. So I can potentially rebuild the project with new scripts. However this may take a rather large amount of time. So I found I can edit the source code through the hex code, but this seems limited/nigh impossible as I need to make a condition on this string instead of simply setting the value. If there is a way to do this with a hex editor on the lib2cpp.so file I would greatly appreciate even a lead. Alternatively I have found some things on hooking a string, but I am unsure of how to go about this and cannot find sources of where to start such a thing.
Any leads or information on how to edit a string on a condition in the unity source code through it's lib2cpp.so file or libunity.so file would be greatly appreciated!

How to decompile kotlin android apk?

I have my own developed Android app in kotlin. I lost my all source code (hard disk crashed) after that I pull my apk from my physical android device using below adb commands -
c:\> adb shell pm path com.digi
Response of this command is full path of apk. after that I used below command to get actual apk-
c:\>adb pull /data/app/com.digi-ZF6WfmctELhsLvm4oICrAQ==/base.apk Destination\folder
After that I used android studio and using build -> analyze APK
This is giving some folder structure but did not get any kotlin class what I developed.
Is there any way to get at least kotlin source code?
Well, yes and no. You can't recover your source code fully, but you can at least get some of it. It will be partially gibberish and partially almost fine, you'll lose local variable names, comments, formatting, etc., so you will need to go through all files and fix them or even rewrite some of them entirely. But still it could be better than starting from scratch.
I did not decompile Android apps for a long time, so my knowledge may be outdated, but the standard procedure is:
Convert the code from dex to jar.
Decompile to Java.
In your case: convert Java to Kotlin.
Ad.1.
AFAIK there are two tools to do this: dex2jar and enjarify. I suggest using enjarify, it always gave me better results.
Ad.2.
There are several Java decompilers and some of them will work better with some code, others will work better with another. I suggest trying at least Fernflower and JD-CORE/JD-GUI, maybe Krakatau.
I guess the results will be far from perfect, because the application is written in Kotlin, not in Java. Suspend functions and other features specific to Kotlin will be even worse.
You can also use ByteCodeViewer which is a GUI applications that simplifies the process of 1. and 2. It contains all above tools and more. You can also switch the decompiler dynamically to see results of different ones.
Ad.3.
IntelliJ has some utils for converting Java to Kotlin. I never tried this with decompiled code and I guess it will be problematic
If you would need to recover the resources (XML files, etc.), you can try to use apktool.

How to Bypass the Android Studio AAPT Raw File Size Limit

I added the Android Studio tag because, though I'm using Android Studio, I wasn't sure if this was an Android problem or a Studio problem...
So I have this particular app that I want to make that will require having a specific audio file that will end up being around 1.5 hours long. Naturally, this means that the file's size will be very large. The file I wanted to use (256kbps) was around 170MB. WAAAAY too big for Android, apparently. I did some testing, and while a file with the size of 65860KB is too big, one with the size of 65515KB is acceptable. I can also do multiple files of 65515 or smaller with no issues.
Now, the problem that I'm getting, when I try to use a file bigger than 65515 KB, I get some ambiguous AAPT2 error message in the console:
https://pastebin.com/eJvtF1NE
Error text, no code
And when I click on Toggle View to have a look at the gradle output, I see
{pathToSource}\app\build\intermediates\res\merged\debug\raw_ee7.mp3.flat: error: failed to read data meta data.
I honestly don't know what that means, but it seems like it's at least related to the fact that it's a big file. I've tried the android.enableAapt2=false option in gradle.properties, but while a Clean Build operation succeeds, I get a warning saying it's deprecated and shouldn't be used anymore, and when I try to run or debug, I get an error message saying
Error while generating dependencies split APK
com.android.ide.common.process.ProcessException: Failed to execute aapt
I got the idea to try the aapt2 disabling from this other question here on SO:
https://stackoverflow.com/questions/46961577/android-studio-error-failed-to-read-metadata-after-update-to-3-0-0
But id doesn't work anymore, and it looks like Google haven't fixed it in their end yet.
So is there anything I can do until they fix it themselves, other than changing IDEs? I could, because I just barely started developing this app. I can't feasibly cut that file into smaller pieces, because playback will require a degree of precision I can't get with handling multiple instances of MediaPlayer.

Flash Builder embedding files into app like flash IDE?

I'll try to make this simple :
If I create an AIR app from the Flash IDE, I can choose to embed folder in my package. Then I can load the files using 'app:/'+filename. Everything is ok.
I have to move to Flash Builder because I can't test workers in the IDE (thanks Adobe). My issue is that, if I test/debug from Flash Builder, it does a stream error when calling 'app:/'+filename. If I launch the test in the IDE from FB, it works but the Workers don't. I should mention, the reason I'm using this method is that I have so many graphical assets, it's just easier to maintain/update this way instead of using [Embed.. ] for all my items, and it just works in the IDE...
I've added my folder to my sources locations in Flash Builder, still it seems I cannot use the 'app:/' thing.
How can I make this work so I don't change my code and still use 'app:/'? FB is such a confusing program...
edit : I tested again the workers in the IDE build launched by FB (the test in flash IDE icon), I can trace its state with :
worker.start();
worker.addEventListener(Event.WORKER_STATE, this._handleWorkerState);
private function _handleWorkerState(__e:Event):void{
trace(__e.currentTarget.state);
}
traces 'new' then 'running'. But for some reason, it doesn't send or receive any data from any message channel, which, again, works in FB4.7 when i run a debug but doesn't find my files....
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: app:/foldername..
So basically, I'm looking for a solution to at least one of my problems :)
EDIT :
So ok. Here it is, one issue was due to the wrong debugger version installed (for the workers part). So I can now work and compile in the IDE again. I haven't found an answer to why 'app:/' doesn't work from FB4.7. So that would be the remaining question.
One option since you have Flash IDE is to create a library with all of your images. Drop all your images into the library in Flash and export them for actionscript. Then publish and create a a SWC. Then you can use the swc, which is kind of like a zip file for display objects, in flashbuilder and access them like:
var mc:MovieClip = new imageExportedForAS3_1()
Create a top level folder in your flex project called for example images, copy all of your images into that folder, then every time you need to load an image, just use the source attribute and use the absoulte rute, for example.
<mx:Image source="#Embed(source='../images/pic.png')"
I have never used the app:/ sentence before! Good luck!

Issue Debugging Reason XML Won't Parse

I am having some difficulties with my android app parsing an xml that contains links to PDF files. It should open a listView showing all of the files listed in the xml. However, most of the time it just freezes up on me. The app was made by a developer no longer with us, and all I have is the apk and not the source files. Is there a way to use the apk to get the source files and figure out what the issue is? Android is not my forte and I'm at a loss with how to fix this.
UPDATE:
It appears that devices running 2.2 display all the songs just fine, while the newer versions of Android crash when ran.
I've had problems with android 2.2 on my HTC desire taking a long time to parse large XML files. There wasn't much I could do other than switch from DOM to SAX which for some reason was a lot quicker
However debugging this without source code is likely to be pretty difficult. Not least because fixing the issue when and if you find it will require you to re-compile a new class in replacement for the one which keeps freezing.
I would suggest you look into decompiling the APK back into source code.
According to Wikipedia APK files are based on the Jar file format which in turn is a Zip file:
http://en.wikipedia.org/wiki/APK_%28file_format%29
That makes this task a little easier as you won't need to look for a decompiler that is specific to android but a more generic Java Decompiler.
A quick search on google suggests this one:
http://java.decompiler.free.fr/
If you can decompile the app back to source code and then get that source code into eclipse and rebulild from source then you can start to debug.

Categories

Resources