How to find Bonjour in local wifi in Android - android

I have a problem that I want to get an Ip of remote computer via Bonjour which is preinstalled . But I unable to connect with that, I don't know why because I have download an example code from Git Hub and also download the jmdns3.4.1 Jar. But the sample contains the error as Conversion to Dalvik format failed with error 1. Then I have written this question to get the exact answer.
Thanks is advance.

First off you need to use a special version of jmdns compiled for Android found here. The reason is Android cannot actually execute Java class files, but rather executes Java dex files since it uses Dalvik.
It may also be a jar-conflict if you are 100% sure you're using the right jar-file. See this question for more information.

Related

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.

an issue about extract source code of an apk

Hello I lost my last backup of my project and there is just installed the app on my phone so I need to rescue my codes.
I searched dex2jar,apktools etc but they did not work.
In my apk there is 6 dex class so I can not reach my code
You can extract your code from http://www.javadecompilers.com/apk this link
Note: It can give you all your java classes and resources, but you
have to work on it for some missing constraints. Please do not make
misuse of that....
But its better to have something than nothing.

Delphi XE5 using ftdi jar file in android

I'm trying to use the FTDI (d2xx) jar file in Delphi XE5 in a android app.
http://www.ftdichip.com/Drivers/D2XX.htm
But I cant get I to work..
Has anybody got any examples on how to import a (this) external jar file?
OR has done this jar file and got it working (so I know it is possible).
I have tried the methods from
XE5 - Fun with external Java libraries
Well I did't have fun, I can't get I to work (easy peasy?).
I don't know what class to load. I have got a assigned "DEXClassLoader" but don't know what class to load. If I look at the dex file I think it should be 'com/ftdi/j2xx/D2xxManager' but I get a "java.lang.classnotfoundException: com/ftdi/j2xx/D2xxManager" message.
The second option I found was the one from Bian long (coderage 8)
I am still investigating this but my demo licence of XE5 is running out.
(I also found the "Android 2 Delphi Import Tool". But i dont know if it works.
If it works I want to buy it. it's only 80 euro)
If I don't get It working we will not update to XE5 (but I want to..) and wait until there is more documentation / samples.
Can anyone help me..
About your second question
OR has done this jar file and got it working (so I know it is possible))
yes, it is possible. http://www.winsoft.sk/acpftdi.htm
They are selling a source for $60 and have a free demo.
And as an answer to the first question: it's really just an automatic conversion of jar file. I have tried a Java2OP utility from embarcadero and Winsoft's example with minor changes successfully compiled and executed using pas-file generated by Java2OP.exe instead of their library.
So, if someone want to use FTDI with delphi on android, my way of getting it works for free is:
Get Java2OP.exe from http://docwiki.embarcadero.com/RADStudio/XE7/en/Java2OP.exe,_the_Native_Bridge_File_Generator_for_Android (you need a registered delphi to download)
run it:
Java2OP.exe -jar d2xx.jar
After completion, add d2xx.jar and generated pas file to your project, take the example code from http://www.winsoft.sk/acpftdi.htm or from java examples that comes with d2xx.jar.

Android native methods called from Java side

How can I get reach to the native methods called from Java side in Android? My problem is specifically related to AudioRecord class in Android Media package. I read the source code of AudioRecord.java. I found out that most of the jobs is performed by native methods, such as:
native_setup(...), native_start(...), native_stop(...), native_read_in_byte_array(...), native_read_in_direct_buffer(...)
I downloaded Android source code but I could not reach these methods. And I don't actually know the way to reach them. I seek for these methods in libraries I found in source code directories, but I couldn't success. If anybody may have an idea, I would be appreciative to hear. Thanks...
I think I found them. After using the Linux command
grep -r "native_read_in_direct_buffer" ./ANDROID_SOURCE/.*
I found the corresponding cpp files.
AudioRecord.cpp is located in: ~/ANDROID_SOURCE/frameworks/av/media/libmedia/ directory,
android_media_AudioRecord.cpp is located in ~/ANDROID_SOURCE/frameworks/base/core/jni directory.
I wanted to share it as a reference to other possible programmers willing to reach the same/similar source files.

how can I access SVN from an Android device

I've been trying to use SVN Kit to gain access to an SVN repository from an Android app.
Our project is supposed to check for changes to files and download them if they have changed, but still with the ability to rollback to previous versions if nessecary.
I set up a regular Java project, and had no problem using SVN Kit, I logged into the SVN server and retrived a list of the files stored there.
But when I tryed to do this from an Android project all hell broke loose. The VM run out of heap space, just trying to build it and Eclipse went down in sreaming flames mith comments like 'GC overhead limit exceeded'.
I get the impression that this is due to the diffrent type of virtural machine that Android uses, and the SVNKit jars are compiled for a diffrent type of VM.
This Guy claims to have got it working, with what looks like an older version of Android.
Now I have suggested that we use some kind of ftp server approach, uploading new versions of the files, perhaps with seperate files containing versioning information, but I have to explore this path before I write it off as a dead end, or at least suggest that to my boss!
anyu help or suggestions would be greatly appricated.
My answer may not be directly related to SVNKit but would actually try to address the original problem.
As I understand your use-case, you want to download files if they have changed and are trying to use SVN to do this with its update command. I would rather create a simple web-service which should return me the list of files with their checksums or md5Hash. Now I am assuming that only the relevant files are present on the server. Upon receiving the hashes, you can compare them with the hashes on the device and decide to update based on any difference. This approach will work for rollback too as you need to just replace the file on the server with old file and this would be treated as a new one.
As far as heap overflow and out of memory is concerned, they are mostly because of the limited heap space around 10MB.
I created a SVN client based on SVNKit it is available for free here : https://play.google.com/store/apps/details?id=com.valleytg.oasvnlite.android
I am not sure if that will work for your purpose or you have to build your own. If you are looking to build your own, svnkit will not work directly on the android platform. Some of the libraries used by SVNkit are not available on the Android platform.

Categories

Resources