Build.gradle ART Configurations - Android Studio

I am trying to customize my dex2oat installation args, I have seen an example of how to do this with an Android.mk file, but not with a gradle file. I would rather not have to change build types. Does anyone know how to update say the '--compiler-filter' flag from the build.gradle file?
Thanks!

Related

AndroidManifest.xml (and maybe other) problems

Hi all,
I modifed an app so that it would run on my phone--I have a cyanogen ROM, and it doesn't play well. The app runs fine on my wife's stock G1. Anyway, I used baksmali and smali to make the necessary changes, and it recompiles fine. I also "decrypted" the AndroidManifest.xml (from binary to text), resigned the package, and I get the dreaded "file does not contain AndroidManifest.xml" error.
Apparently, the AndroidManifest.xml doesn't get built back to its binary mode during the package signing.
1. How do I get AndroidManifest.xml back into its proper binary format?
2. Is there anything else I am missing?
Thanks.
The XML files are converted during the process of building the .apk file, i.e. by "aapt". You can do this manually if you want.
http://developer.android.com/guide/developing/tools/aapt.html
derfolo said:
I also "decrypted" the AndroidManifest.xml (from binary to text)
Click to expand...
Click to collapse
By what means did you accomplish this? Did you use aapt or did you do it manually?
lbcoder,
There is a handy tool to do this called AXMLPrinter2.jar. It is available here:
http://code.google.com/p/android4me/downloads/detail?name=AXMLPrinter2.jar&can=2&q=
I am having problems using aapt to "binarize" only the AndroidManifest.xml file. I can't package the entire app, because the baksmali files are not recognizable by Eclipse as java files, and when I use smali, it is all converted back into classes.dex. Any ideas?
Just to be clear, I am doing:
Code:
./aapt package -z -u -A ./app.directory -F ./app.name.apk
An .apk file pops up with no errors, but: 1) AndroidManifest.xml is not converted to binary, and 2) the same error "does not contain AndroidManifest.xml" occurs.
Thanks for any help.

can an OTA update be modified?

How can one go about modifying an OTA update? I see there is an updater-script file in-particular that checks the ckecksums of system files before loading the OTA... can this file be modified and what would be the procedure? Thanks in advance.
I'd like to modify the checksum values listed in this file to have it accept certain modified system files... What is used to calculate the checksum values?
Should be in Q&A. Reported.
Moved to Q and A
I found that sha-1 is used to create the checksums values in the updater-script file. In the assert check_patch lines the first value is the new file and the last value is original file. In the assert apply_patch lines same is true except middle value is size of new file in bytes.
Beyond this it looks as if the CERT.RSA, CERT.SF, and MANIFEST.MF files in the META-INF folder of your update.zip may be the next obstacle... I know this thanks to jhankinson thread on the topic.
I don't know if jhankinsons solution to simply deleting these and resigning would work on the Bionic? (I'm total noob in this regard.)
Perhaps we can edit the checksum values in these files. I found that in the MANIFEST.MF file checksums are simply SHA-1-BASE64.
Anyone know what is used for the values in the CERT.SF file? (it says it's sha1-digest but i'm using fsum-frontend with no luck getting a match)
And would I need to do anything with the CERT.RSA file? (Again total noob to how these are signed)

Issue with the dependent library

I trying to use Gstreamer on Android via Xamarin.Android(in the Visual Studio), so I built this sample project(github.com/jaroslavas/Gstreamer-Android-example) on the Ubuntu, took the compiled libtutorial-5.so and libgstreamer_android.so libraries and added them into the Xamarin.Android project as AndroidNativeLibrary's. When I try to use libgstreamer_android.so using DllImport, then all going ok, but when I try to use libtutorial-5.so (of course using DllImport), then I get:
DllImport unable to load library 'dlopen failed: could not load library "build/obj/local/armeabi-v7a/libgstreamer_android.so" needed by "libtutorial-5.so"; caused by library "build/obj/local/armeabi-v7a/libgstreamer_android.so" not found'.
Click to expand...
Click to collapse
This error occurs because libtutorial-5.so depends on the libgstreamer_android.so. libtutorial-5.so trying to find libgstreamer_android.so library in build/obj/local/armeabi-v7a/libgstreamer_android.so location.
But of course these two libraries are located in the lib/armeabi-v7a directory and even if I replace all two libraries or just libgstreamer_android.so in this location, then I still have this error.
So how can I change path of the library on which my first library will depend in the Android Studio or just in the .mk files(on the .so building stage)?
Hi, lib not found may cause by:
1. Lib is not exist.
2. Lib that declare in Build.gradle that is different that that you load in java class
3. Function name is not follow the form (the dot. in package name of java class is replaced by "_" in c++ function and class.
4. Clean project and rebuilt it. If you not clean, old lib .so will not be deleted.
5. Check if you declare create in android.productFlavors{}

How to force build system to ignore resource files in Android Studio

Can anyone give me a simple way to force build system to ignore resource files in Android Studio?
Cheers
lintOptions {
abortOnError false
}
Adding this in your app gradle file will force it complete the build even with errors in it. Or, you can simply comment those files.

[Newbies][Documentation]What's an apk and how does it work

Quick Intro :
Let me answer that question, an apk, first of all, is the format of Android apps, as .exe would be for Windows, apk means Android Package by the way.
But what’s the big deal?
Well an apk contain a lot of things into it.
When you open it as an archive, you might get those files:
AndroidManifest.xml
assets
res
META-INF
resources.arsc
classes.dex
AndroidManifest.xml is the file that contains the information about the app itself: the list of all activities, all permissions, the name of the app’s package, and the software/hardware requirements. To be able to read it, you’ll need to decompile the apk file.
Assets and res folders are meant for resources. Most often, you won’t see the assets folder because its usage is limited, (explanations here). We’ll focus on res since asset isn’t used so often.
META-INF contains CERT.RSA and CERT.SF (certificate) as well as MANIFEST.MF (a manifest)
Those files are the app signature, and META-INF is the folder that contains signature.
The resources.arsc file is the file holding most of the resources that were originally in the res folder. After compiling the code, Android Studio (or others software) compile resources into this file. You won’t be able to open it with an archive explorer. We’ll need to decompile the apk to get the resources back into the res folder.
And, finally, the classes.dex file contains the every smali files of the app. A smali file contains the java code for a specific part of the app. To be able to have the smali files (into the smali folder), you’ll have to baksmali your app.
Hopefully, apktool (a reverse engineering tool) does it for you.
Let’s decompile the apk using apktool (a popular tool used to decompile apps):
Once apktool is installed (see the apktool web page to know how to install), you’ll need to use the command prompt to decompile the apk:
Code:
java -jar apktool.jar d [name of the apk].apk
(I advise to create a folder and to put every file needed in it: the apk, the apktool.jar file, and the apktool script).
You’ll have an out folder, and when you browse it, you’ll have most of the time:
AndroidManifest.xml
original (a folder)
res (a folder)
smali (a folder)
The AndroidManifest.xml that you see here is the translated one.
In the “original” folder rest the META-INF folder and the original AndroidManifest.xml file (untranslated). As you can guess by its name, this folder contains unchanged original files.
The res folder is now full, because every resource from the resources.arsc file are now back into the res folder
Same for the smali folder, this folder contains every piece of code contained into the classes.dex file.
We will now focus on the res folder. Now that it’s complete, we can see those folders (it depends on your apk, but here is the list of the most common ones):
anim (other animation stuff, see the links at the end of the thread)
animator (animation properties)
color (color state list: in which condition this color is used for a particular element)
drawable (can be pictures or xml files, it contains a lot of things)
layout (contains the files that define the layouts of the app)
mipmap (icons for different screen densities)
values (xml files that contains values, that will be referenced in other xml files in other folders)
xml (every other unclassified xml files)
Those folders contain files that will be named following their resource ID.
So how does all of this work together?
Well, the java code written in the smali files will call resources with their IDs. This way, the app will show you the write thing at the right moment, following the code. The layouts are already described in the layout folder. What the code really do is analyzing the action of the end user and calling other resources in consequence.
For example, I’m using the XDA Labs app on my phone. I’m in my phone’s section, and I’m about to click on a thread to open it.
I clicked on the thread, so the code loaded the thread layout with every post in it, and other resources such as the little arrows at the top to jump to the end/beginning of the thread, the reply button, its color, … That’s how to work if I want to keep it simple.
I tried, in this guide, to simplify android app basic for beginners. Feel free to ask any question, I’ll be glad to answer.
If you want to go further into it, you can read a very complete guide about app basics by google (it’s a bit complicated to read, assuming you’re just starting to understand).
Here are the links:
https://developer.android.com/guide
If you have any question about that guide, you can also ask me (with the quote you didn’t understood).
Keep at mind that mastering app basics is really important if you ever want to theme/create an app. So, this guide and the google one is a good place to start.
Have fun reading
Hello Raiz,
I decompiled the apk of an androind app from playstore using dex jar and apktool however I can't find the scripts anywhere in the resulting files. Where should I look? Or is there something more that I have to do? I'm trying to edit something for personal use to make the game more enjoyable. I saw a .unity3D file in there so I presume it was made in unity if this helps.
Good tutorial about concepts of APK file. The details you share are so educational. Thanks for sharing

Categories

Resources