How to change a file generated by J2Objc - java

Hello I have been trying for a while to changue the url from a file .m generated by the tool j2objc but xCode seems to not notice it, when I recompile the whole project it's still pointing to the url generated from the java file.
Could you help me to figure out how could i make this change, I have been looking for hours but i have couldn't.

After several intents I find out that this is not possible, the reason is simple, when you compile the Java code with J2Objc the api generates .o files and .m & .h files just for reference, but the files that your iOS app is going to use are already compiled (*.o) so although you modify .m and .h will not take effect because xCode is using the .o files generated by j2Objc.
So the solution is recompile again the changes with j2objc.

Related

Using external non-Android Java library in Android: couldn't find .so file and so on

I'm trying to build a template Android app using Grammatical Framework's Java bindings (however, I don't think what Java code I'm using in particular actually matters. Let's just say I'm trying to use some external non-Android Java code in an Android app).
After some trial and error, I got to successfully build an app using this external code by following these steps:
generating a .jar file for the library I want to use (it's called jpgf.jar
copying it to app/libs
adding it as a library and verifying that the build.gradle gets updated with
implementation files('libs/jpgf.jar')
importing it in my app's MainActivity and writing some code that uses it
However, nothing can be easy in Android development, ever. So my app, after nicely compiling, crashes on startup with the following error:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/bho.harisont.gfdemo-8c870hpW06uEnMQHV1ILjw==/base.apk"],nativeLibraryDirectories=[/data/app/bho.harisont.gfdemo-8c870hpW06uEnMQHV1ILjw==/lib/x86, /system/lib, /system/product/lib]]] couldn't find "libjpgf.so"
In short, some .so file can't be found. Now, I'm not Java or .so file expert, but I do know that when I installed jpgf system-wide on my machine using the dedicated Makefile, a .so file was generated and copied to some location. My probably naive attempt was to take that .so file and move it to the appropriate subfolder of jniLibs. I know I placed it in the correct folder and all, because in this way I managed to change the error message, but not to solve the problem: at this point the complaint is that libjpgf.so is 64 instead of 32 bits. You bet, my machine is 64 bits.
So, to help me you can answer one both of these questions:
how do I compile a 32 bit version of the .so file on a 64 bit machine? I tried some gcc options but it's not like that helped
do I actually need that prebuilt .so file? I see other people just importing JARs. Can I not just do that (or even import the source code somehow), and have Android Studio generate all the assets it wants the way it wants?

Modify Android Java source code and repackage to APK file

I decompiled an Android APK using Jadx-GUI to view the Java source code. I want to modify the application, but the only way to do that is to make changes to the smali code and repackage the files into an APK via apktool.
I currently have made some changes to the Java code for a particular file. I now want to make the changes to the corresponding smali and then repackage the app. I am confused on how to do this.
Convert .Java file to .Smali file
From this post:
"You can compile the java classes using a normal java compiler, and then use Android's 'dx' utility to convert the compiled .class files to a dex file. And then run baksmali on the dex file to produce the smali files."
I'm not sure what this means. Do I need to just compile the one file I made the changes to? Or do I compile all the files of the project together? Since smali is android assembly, I would imagine that I would need to compile everything together so that registers are allocated properly, etc.
Lastly, if I use a normal java compiler, won't the compiler throw an error when it encounters Android specific imports?
Eg. import android.graphics.drawable

NetBeans cannot find stuff in a jar

I'm working on a project which wraps some C++ code using SWIG and then need to write a java interface around it. I can do this no problem manually but NetBeans is opaque enough I can't seem to get it to work. I have a C++ project which builds the JNI and then packages the SWIG wrapper Java files and the JNI into a JAR.
I add that JAR to the Java project. It clearly shows up in the GUI, but my main code can't call any of the code contained in the JAR. I've tried every permutation of package names and so on without any luck. I tried to directly set the classpath using compiler flags in NetBeans but couldn't tell if it was actually doing it.
The JAR file needs to contain the java class files. It appears to only contain the source files..

how to Open source code from android apk created through adobe Air( coded in flash)?

I am trying to generate the source code from apk (which is created by adobe air, which is actually coded in flash)but It generates with no java classes and no images in res folder. The app actually a game app which has a 50 images in it. Can any body suggest me that, how to get the converted flash code into java files and the resource through the apk. I would be obliged if any suggests. Thanks in advance.
umm... you need to disassemble the APK. Did you check inside for .dex or .class files?
If yes, you might be able to use something like DJ Java Decompiler on those .class files. But android uses .DEX files instead of .class and .APK instead of .JARs.

How can I extract java exe to jar

I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar files can be run on any platform that can run java and I would like to use a windows compiled java program on mac without using any extra virtualisation (wine,vmware)
It depends how the exe has been built:
If it has simply wrapped, with a tool like JSmooth, the same tool can extract the jar
If it it has been compiled, with for instance gcj (as illustrated by this question),... I am not sure.
If it has been compiled by a static compiler (or AOT - Ahead-Of-Time -), I believe it is not possible to extract the orignial jars.
If your application was wrapped using JSmooth, you can look in your default temp directory (C:\Documents and Settings\Username\Local Settings\Temp) while the application is running.
Open a windows explorer window to the temp dir, then start up your application. You should see a jar file show up (Temp#.jar). Just make a copy of this and you should be on your way.
i suggest just rename your file extension from .exe to .jar and try to extract them.
to view the code use java Decompiler LIKE:
http://java-decompiler.github.io
It is possible to convert file.exe back to file.jar , To go with this reversing process to will require you to know how the file was beeen encrypted ,for example if is the first level encryption class name and files are not hidden , for the second level file classes are hidden , for the 3rd level file and classes are hidden . to get this well download jar to exe software and try how they convert jar to exe then you will be able to know the reverse. to know how you proceed with reversing the process there is a single blog which helped me and all tools you may use are listed there like : Resource Hacker
Winhex
Ollydbg 1.10+ MemoryDump 0.9 and Olly Advanced or StrongOD Plugin(for advanced ctrl+g).
DJ Java Decompiler
7-Zip or Winrar
The link:
https://reverseengineeringtips.blogspot.com/2014/12/unpacking-jar2exe-21-extracting-jar.html?showComment=1480364662658#c447064983483780468
thanks

Categories

Resources