I have an .apk I decompiled and I see there are **.so** files used in that code.
How do I find the **.mk** file from that source code?
You can't.
Build scripts like build.gradle and the .mk, if there even was one, are used to build the .apk but are not included in the output of the build i.e., the packaged .apk
Related
How to add .java source files of android project to .apk using gradle? Suppose you have been given this android kotlin app sample. How to extend build.gradle.kts to include .java files from ./app/src/main/java/org/gradle/samples/ to the .apk archive during build process? The target should be the root directory of .apk archive.
I've read several posts, such as this and this. But I haven't been able to complete the task yet.
When I try to generate an apk file from android studio "src" code in there in apk file. I opened apk using "winrar" but, there is no src folder in it.
What is happening?
Your source code is converted into dex file. You will file .dex file in the extracted folder.
When you build APK in the android studio. It converts your source code into java ByteCode(.class file) and then again process all class file into single/multiple Dex file(.dex) based on method count.
Check this image for more information:
Image Reference link.
The src folder is your source code.
No Java or Android application actually runs your source code, rather all Java files are compiled to class files and relocated to the classpath of a JAR, or APK or AAR for Android. Typically there are folders for each package, then class files under that
When I use ant tool for build an android project, I do not know how to add custom folders to the apk file, such as a a folder named "running" under the project root, when I use the eclipse can be directly add to apk. I hope you can give me some help, thanks!
During the build process, your Android projects are compiled and packaged into an .apk file, the container for your application binary. It contains all of the information necessary to run your application on a device or emulator, such as compiled .dex files (.class files converted to Dalvik byte code), a binary version of the AndroidManifest.xml file, compiled resources (resources.arsc) and uncompiled resource files for your application.
I can't figure out why you need to add the folder to apk, well if you are asking about adding it in the project and later to be accessed in the apk then yes you can place it inside the "assets" folder of your project
I've been trying to solve a problem about Android build, but couldn't figure out how to solve it.
Basically, I am trying to build an Android project using Gradle. It works perfect, but the size of the final apk is 7MB more than when I builded with Eclipse.
When I unzip the apk, I see that the JNI Libs are included twice. Which is different from the Eclipse build that includes it only one time. Here is the paths I can find them in the APK:
lib/armeabi
lib/armeabi-v7a
main/jniLibs/armeabi
main/jniLibs/armeabi-v7a
In my project, those two files are in:
android/app/src/main/jniLibs/armeabi
android/app/src/main/jniLibs/armeabi-v7a
I have two different build.graddle files in:
android/
android/app/
None of them contains anything related to the JNI Libs.
To build a release, I use the command:
./gradlew assembleRelease
And everything works fine. I use Gradle 1.10.
I was wondering if someone ever encountered the problem and find a solution to avoid to the JNI Libs to be included twice in the APK.
Thanks :)
Put .so files in...
/src/main/jniLibs/armeabi-v7a
/src/main/jniLibs/x86
directories and gradle will correctly package the .so files into the correct app and it won't include the duplicates
This is a good reference..
http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/
Actually I want to know that if in my application's libs folder, any library file(e.g .jar file) is present, then after installing(running) that application, will library file present in .apk file?
According to my understanding, library FILE should present in generated .apk file. If I am wrong then please correct me.
If my question is below standard, then extremely sorry for that. Any help will be well appreciated
With recent versions of the Android tools, .jar files in the libs folder are automatically included in the build. (See Dealing with dependencies in Android projects.) So, yes, the library is included in the compiled bytecode (not as a separate file).
If you use ProGuard in a release build, then it will attempt to strip out any code which is not actually used. So, it may be that some parts of the library are included in the final .apk, and some parts are removed.
the answer is yes. The apk is just a zipped version of your compiled project. If you open it with winrar for example, youll see that everithing is in there ;)
You can try it and see yourself but you can not directly see the .jar file under libs folder in the apk generated. Library class files are all together are compiled into a single .dex file. If you decompile that dex file, you can reach the java codes.