Androguard output truncated - android

I installed androguard to help me analyze my own apps to verify that proguard is doing its job (like removing Log.* messages.)
It works well in general, but I have a problem with commands with long outputs. Two examples are with AnalyzeAPK():
get_strings()
get_classes_names()
When I run these commands, I get a bunch of output relating to the support library, and it abruptly ends with an ellipsis before getting to the classes or strings that I created:
u'Landroid/support/v7/graphics/drawable/DrawerArrowDrawable;',
u'Landroid/support/v7/text/AllCapsTransformationMethod;',
...]
The same thing happens trying to dump the strings.
My question is - what do I have to do to get the full output of the commands?
Fedora 25 - Python 2.7.13 - ipython 5.0 - Androguard 3.0dev

Related

Android Cuttlefish Device Not Booting - launch_cvd Command Not Working (Error: run_cvd returned 23)

I have built a custom ROM that I'm testing on Android Cuttlefish, but when I go to boot the device on the command line using the launch_cvd command, I get the following errors:
[assemble_cvd ... fetcher_config.cpp:212] Could not find file ending in kernel
[assemble_cvd ... fetcher_config.cpp 212] Could not find file ending in initramfs.img
run_cvd returned 23
Subprocess 39641 exited with error code: 23
The main issue seems to lie in the 'error 23' that is returned by run_cvd.
I have tried Google searching and browsing popular forums where Android is built and debugged (XDA Forums, Reddit, StackOverflow, the Android Building Google Group, YouTube, and the web in general). I have also posted on Reddit and will post on the Android Building Google Group. Additionally, I have looked through the source code for Cuttlefish on Google's Git repo to find why the program is outputting the error to no avail.
Lastly, I read through the logfiles of Cuttlefish to see the errors outputted by Cuttlefish. The kernel.log file seems to show the kernel booted successfully (despite the command line saying that it couldn't find the kernel file), I would imagine the same is true of initramfs.img, but I have no way of confirming that initramfs.img was successfully found by launch_cvd. The logcat file is empty (likely because the Cuttlefish failed to boot) and launcher.log simply reproduces the output on the command line (which contain the four errors I listed above).
Could anyone help me troubleshoot this issue? Your help would be greatly appreciated!
Do ps -A | grep crosvm to see if crosvm is running already.
If it is do stop_cvd || true or kill crosvm process with process PID.

Unity3D build error : Failed to compile resources

I use UltimateMobile plugin and uniwebview plugin ,maybe they are conflict.
when I build ,Unity3d console say :
Failed to compile resources with the following parameters:
-bootclasspath
"C:/Program Files/Java/android-sdk-windows\platforms\android-27\android.jar" -d
"C:\Game\3drq\superblocks\Temp\StagingArea\bin\classes"
-source 1.6 -target 1.6 -encoding UTF-8
"android\support\v4\Manifest.java"
"android\support\v4\R.java"
"com\cheerflame\superblocks\Manifest.java"
"com\cheerflame\superblocks\R.java"
"com\google\android\gms\Manifest.java"
"com\google\android\gms\R.java"
"com\google\android\gms\ads\Manifest.java"
"com\google\android\gms\ads\R.java"
"com\google\android\gms\ads\impl\Manifest.java"
"com\google\android\gms\ads\impl\R.java"
"com\google\android\gms\analytics\Manifest.java"
"com\google\android\gms\analytics\R.java"
"com\google\android\gms\appinvite\Manifest.java"
"com\google\android\gms\appinvite\R.java"
"com\google\android\gms\auth\Manifest.java"
"com\google\android\gms\auth\R.java"
"com\google\android\gms\auth\api\Manifest.java"
"com\google\android\gms\auth\api\R.java"
"com\google\android\gms\base\Manifest.java"
"com\google\android\gms\base\R.java"
"com\google\android\gms\drive\Manifest.java"
"com\google\android\gms\drive\R.java"
"com\google\android\gms\games\Manifest.java"
"com\google\android\gms\games\R.java"
"com\google\android\gms\gcm\Manifest.java"
"com\google\android\gms\gcm\R.java"
"com\google\android\gms\iid\Manifest.java"
"com\google\android\gms\iid\R.java"
"com\google\android\gms\plus\Manifest.java"
"com\google\android\gms\plus\R.java"
"com\stansassets\androidnative\Manifest.java"
"com\stansassets\androidnative\R.java"
"com\stansassets\billing\Manifest.java"
"com\stansassets\billing\R.java"
"com\stansassets\googleplay\Manifest.java"
"com\stansassets\googleplay\R.java"
"com\stansassets\mnp\Manifest.java"
"com\stansassets\mnp\R.java"
"com\stansassets\social\Manifest.java"
"com\stansassets\social\R.java"
����: C:\Program Files\Java\android-sdk-windows\platforms\android-27\android.jar(java/lang/Object.class):
���汾 52 �� 51 ��, �˱�����֧�����µ����汾�����������˱�������
����: C:\Program Files\Java\android-sdk-windows\platforms\android-27\android.jar(java/lang/String.class):
���汾 52 �� 51 ��, �˱�����֧�����µ����汾��
���������˱�������
����:
C:\Program Files\Java\android-sdk-windows\platforms\android-27\android.jar(java/lang/AutoCloseable.class):
���汾 52 �� 51 ��, �˱�����֧�����µ����汾��
���������˱�������
3 ������
why there are so many messy code?
I build the project in another computer,it's fine and can be built to a apk file.
I don't understand ,please help me. thanks !
You should downgrade to JDK 8. According to this SO answer which has a similar error message to your question:
As of Unity 2017, Unity is incompatible with JDK 9. You need to
continue to use JDK 1.8 for the time being.
(Note: there is also an active issue on the Unity Issue Tracker for JDK 9 that seems to be related. It's not the exact same error message, but others are commenting there with your error message as well.)
(EDIT: The question's error message shows "android-27", so this may not be the actual solution. I'm leaving this here for now as a solution attempt, and because one of the most common reasons for this error message, in general, is the JDK version.)
(Also, to give one possible explanation for "why there are so many messy code?": the little question mark with the black box has to do with strings and character encodings. It likely has something to do with the asker's computer language being set to another language like Chinese. I'm not sure about the exact cause in this case, but see The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) for more background information about the black box question mark characters:
And in fact now that you’re thinking of things in terms of platonic
ideal letters which are represented by Unicode code points, those
unicode code points can be encoded in any old-school encoding scheme,
too! For example, you could encode the Unicode string for Hello
(U+0048 U+0065 U+006C U+006C U+006F) in ASCII, or the old OEM Greek
Encoding, or the Hebrew ANSI Encoding, or any of several hundred
encodings that have been invented so far, with one catch: some of the
letters might not show up! If there’s no equivalent for the Unicode
code point you’re trying to represent in the encoding you’re trying to
represent it in, you usually get a little question mark: ? or, if
you’re really good, a box. Which did you get? -> �

API Change error when building AOSP 5.1

Currently trying to build android-5.1.0_r5. I've checked out the sources and made no modifications. However, when compiling I get the following error.
Checking API: checkpublicapi-current
out/target/common/obj/PACKAGING/public_api.txt:20: error 5: Added public field android.Manifest.permission.BACKUP
out/target/common/obj/PACKAGING/public_api.txt:82: error 5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
out/target/common/obj/PACKAGING/public_api.txt:106: error 5: Added public field android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
out/target/common/obj/PACKAGING/public_api.txt:116: error 5: Added public field android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
And diffing the public api txt files does indeed show a difference.
diff frameworks/base/api/current.txt out/target/common/obj/PACKAGING/public_api.txt
19a20
> field public static final java.lang.String BACKUP = "android.permission.BACKUP";
80a82
> field public static final java.lang.String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP";
103a106
> field public static final java.lang.String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
112a116
> field public static final java.lang.String RECEIVE_EMERGENCY_BROADCAST = "android.permission.RECEIVE_EMERGENCY_BROADCAST";
However, I cant figure out where those additional Public Fields are coming from. Any ideas?
Don't do 'make update-api' if you didn't touch anything. There additional apis came form frameworks/base/res/AndroidManifest.xml badly parsed by aapt that uses buggy system/core/libcore/String8.cpp##removeAll() they use memcpy but should be memmove for overlapping strings in memory.
This is issue on latest Debian (sid) or Ubuntu (16 maybe 15) build machines.
It's a google bug in libcore/String8.cpp. Fix is here:
https://android.googlesource.com/platform/system/core/+/dd060f01f68ee0e633e9cae24c4e565cda2032bd
This man found it (Michael Scott) and maybe some other people too. Here is his investigation: https://plus.google.com/+hashcode0f/posts/URHo3hBmfHY
Living on the Edge (of Ubuntu) ... can be painful!
I've been running Ubuntu 15.04 for a while now. It's been great
having a very current kernel alongside the latest improvements from
Ubuntu and Debian. (My past post on using zRAM ramdisk is one
example).
However, having the newest greatest toys also has it's downsides. I
recently spent 4 days troubleshooting a build break in Android which
started some time after March 25th. I'm guessing I updated packages
or inadvertently changed my glibc version.
The outcome was a build error during the checkapi stage of Android
build:
Install: /out/mydroid-ara/host/linux-x86/bin/apicheck Checking API:
checkpublicapi-last Checking API: checkpublicapi-current
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:20: error
5: Added public field android.Manifest.permission.BACKUP
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:82: error
5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:106: error
5: Added public field
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:116: error
5: Added public field
android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
**************************** You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices: 1) You can add
"#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
This occurred on both of my Ubuntu 15.04 boxes and was present when
when build AOSP android-5.0.2_r1 and android-5.1.0_r1.
For those of you who are unfamiliar with this portion of the Android
build, the Android framework exports all of the public portions of the
API and makes sure that the current build matches up with what's
located under frameworks/base/api/current.txt. It does this by
parsing frameworks/base/res/AndroidManifest.xml and any of the current
device's overlay .xml files and processes items marked with various
flags in the comments above them:#SystemApi, #hide, etc. This
parsing and processing portion of the checkapi stage is done by a
binary "aapt" (Android Asset Packagng Tool). It's source is located
under frameworks/base/tools/aapt.
I started by checking for upstream fixes to the platform/build or
platform/frameworks/base projects. After striking out, I began
debugging the android build via the use of: "make checkapi
showcommands" and then manually running the commands with "strace" to
see how each binary was involved and what output it generated.
After the first few hours of debugging, it became apparent that
out/target/common/obj/APPS/frameworks-res_intermediates/src/android/Manifest.java
file had comments which were being corrupted when aapt was generating
it. I was able to make some manual changes to the AndroidManifest.xml
file and get the build to pass (removing extra portions of the
comments).
Digging deeper via strace and then looking at various static link
sources, I found that during the AndroidManifest.xml comments
processing the #SystemApi token was being filtered out via a
String8.removeAll("#SystemApi") function call. Experimentally, I
removed this part of the processing. Lo and Behold! The build
worked. Taking a closer look at the removeAll function, I was able to
pin point a memcpy function as the part of the function which was
causing corruption.
I then researched memcpy a bit and noted that you are not supposed to
use memcpy on overlapping memory addresses, instead memmove was
preferred, because it makes a copy of the source prior to any changes
being made to the destination. After changing the use of memcpy to
memmove the build was fixed and all was well with the world!
As a good player in the open source world, I immediately thought I
should upstream this incredible feat of debugging to the master branch
of system/core. BUT, alas! The fix has been in the master branch
since November 11th 2014! And hasn't been brought into any of the
current development tags! grumble
https://android.googlesource.com/platform/system/core/+/dd060f01f68ee0e633e9cae24c4e565cda2032bd
I've since contacted the Google team about this change and let them
know of my experience in hopes that we may yet see this patch in
future release tags of Android.
Conclusion: apparently glibc is undergoeing some changes and some of
those have now filtered onto my Ubuntu boxes. Where previously the
memcpy usage was incorrect but still usable, it now causes the build
break I was seeing.
If you see this kind of error in your Android builds, and you're on a
newish version of Ubuntu or Debian distrobution, you may want to try
this simple patch and see if it helps.
Hash
Big up himself!
I do see the entries in my r8 code so you are probably safe running make update-api, and when that finishes then run your make command as normal.

android kernel build (first time)

Ok so first off,
Im brand new to android dev. This is my first attempt at any form of kernel anything. I have a limited knowledge of java and python, but no C.
I have a galaxy tab 4 sm-t330nu running 4.4.2. its running a qualcomm snapdragon 400 msm8226 cpu. im simply trying to do a test build with a vanilla kernel at this point. (also my build environment is the newest kali 1.1 and im loosely following the tutorial at https://github.com/offensive-security/kali-nethunter/wiki/Porting-Nethunter)
so i have all of the required dependencies (i hope), and ive downloaded my source from samsung opensource. unzipped and went through the available defconfigs. after finding "msm8226-sec_milletwifiue_defconfig" i decided it was the most likely candidate for my tablet. (when doing a custom recovery i remember it being "philz touch milletwifiue something)
Ive done my exports (arch= subarch= cross_compile=) and all seems well. When i run a build following exactly as the tutorial says (using the defconfig in their example as a test) i receive an error stating "must define variant_defconfig". So i instead do "make variant_defconfig=msm8974_sec_defconfig" and it builds great.
Now the issue:
When i change "msm8974_sec_defconfig" to my actual msm8226 i receive an error on every build that i cannot seem to workaround. (cut down for size)
CC arch/arm/kernel/armksyms.o
CC arch/arm/kernel/module.o
AS arch/arm/kernel/sleep.o
CC arch/arm/kernel/suspend.o
CC arch/arm/kernel/io.o
arch/arm/kernel/io.c: In function '_memcpy_fromio':
arch/arm/kernel/io.c:14:3: error: implicit declaration of function 'nop' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[1]: *** [arch/arm/kernel/io.o] Error 1
make: *** [arch/arm/kernel] Error 2
My exact bash line reads
make VARIANT_DEFCONFIG=msm8226-sec_milletwifiue_defconfig
Any assistance on clearing this up would be great
edit
although im not familiar with c, it seems to me that '_memcpy_fromio' is where the error lies. and my google searches tell me that the error is that a function is used without being declared. however i dont know if memcpy is a function? or is the function within class memcpy (dont know if c has classes just closest equivalent that i know of) how do i debug this code and declare what needs to be declared (more importantly, if this is a stock kernel thats used by thousands of devices, how can it possibly have an undeclared function?
/edit
found the answer! needed
#import linux/modules.h
#import linux/kernel.h

XMLVM Android to iPhone Errors

The conversion of my Android application to the iPhone ObjectX environment as described in the XMLVM user manual works almost fine on my MAC, but I end up with 3 errors in the resulting XCode:
The first two errors simply relate to missing files, namely:
org_w3c_dom_Node.h
android_app_DatePickerDialog_OnDateSetListener.h
These are clearly not files from the converted Android application. Where can I get these from?
The third is an error that keeps coming up in the file
java_lang_String.h
The error message is:
typedef NSMutableString java_lang_String: redefinition as different kind of symbol
This error has been reported before in the XMLVM user group but as far as I know has never been answered sufficiently.
About the first error:
this is part of the Android API that has not yet been implemented.
This is the reason why it can't find the files.
Now, the second problem is not actually an error, but a warning and shouldn't stop you form compiling.
If it does, it means that in your project you have set the option to make errors from these types of warnings.
You can safely turn this off and completely ignore this warning.

Categories

Resources