To answer your question, it is simply impossible to make your APK fully secure. XML files are easily parsed without apktool.
I asked Ben Gruver/JesusFreke (the guy who developed smali) and he said it is impossible to fully secure an APK file, but you can make it harder for others to decompile. As long as Android can read the resources/code in your project.. then so can tools.
The exception you are seeing while attempting to decompile Gmail is because apktool needs to be updated for Lollipop (which is actively being working on).
The answer by @classc_abc is the best I found for making it harder to decompile an APK:
Basically, there are 5 methods to protect your APK being cracking/
reversing/ repackaging:
- Isolate Java Program
The easiest way is to make users unable to access to the Java Class
program. This is the most fundamental way, and it has a variety of
specific ways to achieve this. For example, developers can place the
key Java Class on the server, clients acquire services by access
relevant interfaces of the server rather than access to the Class file
directly. So there is no way for hackers to decompile Class files.
Currently, there are more and more standards and protocols services
provided through interfaces, such as HTTP, Web Service, RPC, etc. But
there are lots of applications are not suitable for this protection.
For example, Java programs in stand-alone programs are unable to
isolate.
- Encrypt Class Files
To prevent Class files from being decompiled directly, many developers
will encrypt some key Class files, such as registration number, serial
number management and other related classes. Before using these
encrypted classes, the program needs to decrypt these classes first,
then loading these classes into JVM. These classes can be decrypted by
hardware, or software.Developers often loading cryptographic classes through a customed
ClassLoader class (Applet does not support customed ClassLoader
because of security). Customed ClassLoader will find cryptographic
classes first, then decrypt them. And finally loading the decrypted
classes to JVM. Customed ClassLoader is a very important class in this
protect method. Because it itself is not encrypted, it may be the
first target of a hacker. If the relevant decryption key and algorithm
have been overcome, then the encrypted classes can easily be
decrypted.
- Convert to Native Codes
Convert program to native codes is also an effective way to prevent
decompilation. Because native codes are often difficult to be
decompiled. Developers can convert the entire application to native
codes, or they can also convert only key modules. If just convert key
part of the modules, it will need JNI technology to call when Java
programs are using these modules. It abandoned Java’s cross-platform
feature when using this mothod to protect Java programs. For different
platforms, we need to maintain different versions of the native codes,
which will increase software support and maintenance workload. But for
some key modules, sometimes this solution is often necessary. In order
to guarantee these native codes will not be modified or replaced,
developers often need to digitally sign these codes. Before using
these native codes, developers often need to authenticate these local
codes to ensure that these codes have not changed by hackers. If the
signature check is passed, then developers can call relevant JNI
methods.
- Code Obfuscation
Code obfuscation is to re-organize and process Class file, making the
treated codes accomplish the same function (semantics) with the
untreated codes. But the obfuscated codes are difficult to be
decompiled, i.e., the decompiled codes are very difficult to
understand, therefore decompile staffs are hard to understand the
really semantics. Theoretically, if hackers have enough time,
obfuscated codes may still be cracked. Even some people are developing
de-obfuscate tool. But from the actual situation, since the
diversified development of obfuscation, the mature of obfuscation
theory, obfuscated Java codes can well prevent decompilation.
- Online Encryption
APK Protect is an online encryption website for APK. It provides Java
codes and C++ codes protection to achieve anti-debugging and decompile
effects. The operation process is simple and easy.I suggest you use this last method for it can save you more time. I’ve
tried. It is very simple to operate and it won’t take long time.
I got this error while I was decompiling an .apk by apktool. Although It doesn’t appear for all apk files.
Also I had installed these three frameworks:
framework-res.apk
SystemUI.apk
twframework-res.apk
I tried two different versions of framework-res.apk but it didn’t help.
What should I do?
Thank you
I: Baksmaling...
Error occured while disassembling class Ldxoptimizer.con; - skipping class
java.io.IOException: The parameter is incorrect
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:176)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:49)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:34)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:74)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:89)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:UsersShayanKapktoolframework1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
exitFadeDuration, value=0x00000190
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f333333
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3e99999a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
showAsAction, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
I: Decoding values */* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x01030119
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:62)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResSca
larValue.java:44)
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
sStyleValue.java:48)
at brut.androlib.res.data.value.ResBagValue.serializeToResValuesXml(ResB
agValue.java:40)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:440)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:243
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
Well, there are many reasons why but I will show you most common errors. Note, i’m talking about general apk modding, not system apk/framework modding
Assets.dex issue «Class xxx has already been interned» and «Not a valid dex magic value»
By default, apktool try to decompile dex from assets folder which would decompile to smali_assets on a root directory of decompiled apk, and compiled to assets.dex upon compiling
This can cause compiling issues
Solution:
To fix the problem, decompile APK again with the flag
to only decompile on main classes in root (classes[0-9].dex) then you can compile without any problem
Note: Only for apktool 2.4.1 and up
You can try to delete .dex from assets folder or smali_assets/assets.dex but it may cause problems
If you are using APK Easy Tool 1.57 and above, you can enable the option «Only disassemble the main dex classes» under Options -> Apktool. Again, only for apktool 2.4.1 and up
Error: No resource identifier found for attribute ‘manageSpace’ in package ‘android’
The attribute does not exist in the framework or it could be fake attribute to prevent compiling
Solution:
Remove android:manageSpace=»true» from AndroidManifest.xml
Error: String types not allowed
Issue: [BUG]Issues repacking res it gives issues with apktool_dummy in integers.xml and dimens.xml · Issue #2462 · iBotPeaches/Apktool
Solution:
In this case:
Code:
W: Failed to generate resource table for split ''
W: E:(PathToDecompiledAPK)resvaluesdrawables.xml:5: error: Error: String types not allowed (at 'APKTOOL_DUMMY_1c2' with value '').
This error tells you which xml an error occured and which line
Open the XML file: E:(PathToDecompiledAPK)resvaluesdrawables.xml
Remove drawable name=»APKTOOL_DUMMY_1c2″ /> at line 5 and save the file
You will get another error about public symbol. See below
Error: Public symbol XXX declared here is not defined.
Public symbol does not exist in public.xml
Solution:
In this case:
Code:
W: E:(PathToDecompiledAPK)resvaluespublic.xml:1133: error: Public symbol drawable/APKTOOL_DUMMY_1c2 declared here is not defined.
Open the XML file: (PathToDecompiledAPK)resvaluespublic.xml
Remove <public type=»drawable» name=»APKTOOL_DUMMY_1c2″ id=»0x7f0601c2″ /> at line 1133 and save the file
Resource error (APKTOOL_DUMMY) (Split APK)
If you get APKTOOL_DUMMY that’s generally because apktool can’t decode some of the information in the original APK and creates a ‘dummy’ value instead. Because there’s no things called APKTOOL_DUMMY in public.xml, the APK can’t be recompiled. It’s likely because you try to compile splitted APK with some missing infomation
Solution:
Merge split APKs manually
Or use the SAP (Split APK Packer) tool
Other issues
— APK is protected, encrypted or obfuscated. Reversing of such files is beyond the scope, so find out yourself
— Invalid syntax in smali and xml. You may have done something wrong
You can search for useful infomation on the following sites.
Report your issues to them if you feel like to
Apktool: iBotPeaches/Apktool
Smali/baksmali: JesusFreke/smali
Я получил эту ошибку во время декомпиляции.apk от apktool. Хотя и не все файлы APK.
Также я установил эти три фреймворка:
framework-res.apk
SystemUI.apk
twframework-res.apk
Я пробовал две разные версии framework-res.но это не помогло.
Что мне делать?
спасибо
I: Baksmaling...
Error occured while disassembling class Ldxoptimizer.con; - skipping class
java.io.IOException: The parameter is incorrect
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:176)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:49)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:34)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:74)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:89)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:UsersShayanKapktoolframework.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
exitFadeDuration, value=0x00000190
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f333333
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3e99999a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
showAsAction, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
I: Decoding values */* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x01030119
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:62)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResSca
larValue.java:44)
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
sStyleValue.java:48)
at brut.androlib.res.data.value.ResBagValue.serializeToResValuesXml(ResB
agValue.java:40)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:440)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:243
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
1 ответов
во-первых, пожалуйста, убедитесь, что вы обновили ваш apktool до последней версии, вы можете следовать инструкции здесь для ее установки.
затем вам нужно обновить файл фреймворка. Когда я попытался декомпилировать файл apk, он покажет ошибку, как это
исключение в потоке «main» brut.androlib.ошибаться.UndefinedResObject:
спец ресурса: 0x01010462
Это вызвано тем, что ваш файл framework не поддерживает последнюю версию версия android, я решил проблему с помощью:
- удалить исходный файл framwork, мой находится в
I: загрузка таблицы ресурсов из файла: / Users/csc/Library/apktool/framework / 1.apk
-
получить надлежащую структуру apk
возьмите мой телефон (nexus 5, android 5.1) для exmaple, вы можете найти фреймворк apk в /system/framework/, и он называется framework-res.АПК. Использование adb pull для его копирования ваш компьютер, переименуйте его в 1.apk, скопируйте его в каталог файлов framework.
-
повторите попытку и проблема решена.
здесь это подробный учебник origin.
- Форумы
- Участники
- Последние сообщения
- Зарегистрироваться
- Вход
1
Посты
1
Пользователи
0
Likes
3,968
Просмотры
(@max)
Reputable Member
Присоединился: 6 лет назад
Сообщения: 358
Topic starter
07.05.2019 11:58
В данный момент смотрят эту тему 1 гость.
-
20
Форумы -
154
Темы -
1,096
Сообщения -
3
В сети -
354
Участники
Иконки форумов:
Форум не содержит непрочитанных сообщений
Форум содержит непрочитанные сообщения
Иконки тем :
Без ответа
Отвеченный
Активный
Актуально
Закреплено
Не утверждено
Решено
Приватный
Закрыто
Вы нашли классную игру но она только для android 4.0+, а у вас android 2.3? Тогда прошу под кат!
Итак, приступим.
Все что нам понадобится это:
- Java
- Apk manager
- Картинка
- Прямые руки вставленные в нужное место и правильным концом.
Первым делом распаковываем apk manager и наблюдаем такую картину
Объясню что это за папки и файлы
- Other — файлы нужные программе
- place-apk-here-for-modding — сюда кладем apk
- place-apk-here-for-signing — сюда кладем apk для подписи
- place-apk-here-to-batch-optimize сюда кладем apk для оптимизации
- place-ogg-here — сюда кладем apk для сжатия ogg файлов
- Project — здесь лежат декомпилированные(разобранные) apk файлы
- log — логи программы
- Script.bat — сама программа
Кладем наш apk файл( моем случае это игра Wrestle Jump, которую я обещал портировать Денозавру, но из головы вылетело) в папку place-apk-here-for-modding и запускаем программу.
Тут все понятно, благо программа на Русском. Жмем «9» и «Enter» и ждем пока наше приложение декомпилируется.
Если все проходит без ошибок, то идем в папку «Projects» и ждем пока я объясню что делать тем, у кого ошибка.
Если у вас возникла ошибка, посмотрите как называется ваш apk файл. Имена вида «Blablabla_1» не приветствуются! Но если файл назван правильно, а ошибка все-равно возникает, проверьте вашу Jav’у.
Все, можно идти дальше. Открываем папку «Projects», затем папку с именем приложения.
Видим там такой набор файлов
Нам нужен только 1 — apktool.yml. Открываем его с помощью Notepad++. После открытия видим это:
Заменяем как на скрине
Сделали? Открываем Apk manager, набираем «14» и жмем «Enter», ждем.
Вылетает нам такое:
Не паникуем, это норма. Просто жмем любую кнопку. Далее бежим в
папку place-apk-here-for-modding и забираем новый файл.
Теперь можете заливать этот файл на трешбокс и устанавливать себе.
Внимание! Приложение установится, но корректная работа не гарантируется.
I: Building resources…
Exception in thread «main» brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 139): [/usr/bin/aapt, p, —min-sdk-version, 9, —target-sdk-version, 21, —version-code, 53156713, —version-name, 34.0.0.13.68, -F, /tmp/APKTOOL3447691795823034561.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /root/Desktop/original/res, -M, /root/Desktop/original/AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
at brut.androlib.Androlib.buildResources(Androlib.java:412)
at brut.androlib.Androlib.build(Androlib.java:311)
at brut.androlib.Androlib.build(Androlib.java:264)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 139): [/usr/bin/aapt, p, —min-sdk-version, 9, —target-sdk-version, 21, —version-code, 53156713, —version-name, 34.0.0.13.68, -F, /tmp/APKTOOL3447691795823034561.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /root/Desktop/original/res, -M, /root/Desktop/original/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:439)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:464)
… 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 139): [/usr/bin/aapt, p, —min-sdk-version, 9, —target-sdk-version, 21, —version-code, 53156713, —version-name, 34.0.0.13.68, -F, /tmp/APKTOOL3447691795823034561.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /root/Desktop/original/res, -M, /root/Desktop/original/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:95)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:433)
… 6 more
This error pop even when decompiling and recompiling original apk