Can't find starting point of android application - android

So, I'm practicing some reverse engineering and now I chose an Android Trojan in order to inspect (Marcher overlay Android trojan from Contagio Mobile malware samples). I've decompiled it using the Apktool and It generated the smali files and everything. The problem is I can't locate the starting point of the application. In the manifest it says:
...
<activity android:label="#string/app_name" android:name="com.paranbijuv.aijuy.bkqbjl.huitou" android:noHistory="true" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
... <!-- no other main/launcher in the xml, only these -->
But there is no "com.paranbijuv.aijuy.bkqbjl.huitou" inside the decompiled sources. Actually there is no "paranbijuv" package at all. To make sure Apktool didn't generate wrong sources I've run a strings command directly into the classes.dex file and also no reference to these classes. My question is how can I reach to the starting point of the app in this case?
Edit: Or, if it is the case of some obfuscation, then the app would have to have a entry point anyway... what sort of obfuscation could cause the entrypoint class to be missing from the classes.dex, if possible?

Search that name in public.xml file and then find it's id and search that in the project.

Related

Android Studio expands Activity name in AndroidManifest.xml

I upgraded my project from Eclipse to Android Studio.
Everything is working, including different flavors (in Eclipse I had an ANT script that auto-generated the sourcecode for the different flavors).
I can also generate the different signed APK's. And these all work on the device.
Also uploading these APK's to GooglePlay is no problem.
User also get these updates, but after the update they need to re-create the shortcut to the app on the home screen. The old shortcut is removed.
I believe this is due to the fact that "Android Studio" modifies stuff in the AndroidManifest.xml when generating the APK.
In Eclipse source, in Android studio source and when I inspect the Eclipse generated APK I have the following (with the name being .StartUpActivity) :
<activity android:name=".StartUpActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However, when I look into the generated apk from Android Studio this is modified to :
<activity android:name="be.abc.android.StartUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
So the name has been changed from .StartUpActivity to be.abc.android.StartUpActivity.
In the end, this is the same path but I believe the shortcut just looks at the name .StartUpActivity, and decides it is no longer available and removes the shortcut....
Can I fix this in someway that the shortcuts don't get deleted. Or that Android Studio doesn't mess with the shortened package names in the AndroidManifest.xml ?
Indeed, as soon as you modify the launcher manifest entry, the shortcut has to be recreated. To avoid such issue, you can make use of activity-alias. A step-by-step guide can be found here.

Migrating to Android Studio will cause multiple apps being installed for "single main project multiple library projects"

I have
Single main project which defines <action android:name="android.intent.action.MAIN" /> and <category android:name="android.intent.category.LAUNCHER" />
Multiple library projects, with some of them defines <action android:name="android.intent.action.MAIN" /> and <category android:name="android.intent.category.LAUNCHER" />
While I'm using Eclipse to build & run single main project with multiple library projects, only 1 app will be installed.
However, if I migrate to Android Studio to build & run single main project with multiple library projects, multiple apps will be installed,
depending on how many projects (regardless main project or library projects) define <action android:name="android.intent.action.MAIN" /> and <category android:name="android.intent.category.LAUNCHER" />
I was wondering, is there any configuration I had done wrong in Android Studio, which causes multiple app to be installed, when I build & run the projects?
Currently, my only workaround is to remove those lines (<action android:name="android.intent.action.MAIN" /> and <category android:name="android.intent.category.LAUNCHER" />) from all library projects' AndroidManifest.xml. Is that common & correct way, to import project libraries in Android Studio? As in Eclipse, those lines don't install extra apps into my device.
This is how my Project Structure looks like
As you can see the first folder icon, looks different than rest of the folder icons. I guess that indicate, the first folder icon is main project, the others are library projects.
If there is only 1 main project, how come there can be multiple apps being installed?
In Eclipse only the AndroidManifest.xml from main app project is used. In Android Studio (and Gradle build system) all the manifests are merged together.
The following lines inside an <activity> element in your manifest indicate that that activity should be shown in the launcher menu. If you do not wish this, remove those lines.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
All of this is intended behavior.
There's another hackish way.
Look up at your merged AndroidManifest.xml. It should be located at:
<your_project>/build/intermediates/manifests/full/<debugOrRelease>/AndroidManifest.xml
Search for the LAUNCHER <activity> tag. In your case you should have more than 1 LAUNCHER <activity> tags. My case looks like this:
<activity
android:name="com.stockhut.SplashScreenActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" >
</action>
<category android:name="android.intent.category.LAUNCHER" >
</category>
</intent-filter>
</activity>
...
<activity
android:name="com.todddavies.components.progressbar.main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In my case, com.todddavies.components.progressbar.main is a library project with a sample project that has been declared as LAUNCHER. The correct LAUNCHER should be com.stockhut.SplashScreenActivity.
Open AndroidManifest.xml in your main project, add the following:
<activity
android:name="com.todddavies.components.progressbar.main"
android:label="#string/app_name" tools:node="remove" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Take note on the Marker tools:node="remove". According to Android Manifest Merger Documentation:
A marker is a special attribute, in the tools namespace, used to express a specific decision for how to resolve conflicts.
Therefore an <activity> tag with the marker tools:node="remove" will tell Gradle to remove itself when there's a conflict. In other words, we are somehow "forcing a conflict". It is a little hackish, but it works.
You can always verify your merged AndroidManifest.xml in the abovementioned path.
In Android studio their can be only one project at a time that can be added.
If you have library with project then you have to either add whole code inside you project or
you can create jar for your library project and add them into your project.
There is another option of gradle in Android studio.
If we want to use any library in project we can add their dependency in "build.gradle" file of Project.
I am attaching a screen shot of "build.gradle" file please refer to it.
Now , As far as Library Projects are concerned , (if it is not contributing to your project) The Best Approach is that in Android manifest you should set only your defined activity as a launcher activity ,As In Most cases libraries AndroidManifest.xml Often contain some sample Activity (which should be removed), or Activity which you need to subclass , There should be minimal defined things in the library project (negligible) most of the things should be in your Manifest including all permission.
Also it is define on android developer site
"a filter with "android.intent.action.MAIN" and
"android.intent.category.LAUNCHER" settings advertises an activity as
one that initiates an application — that is, as one that should be
displayed in the application launcher. The icon and label set in the
filter are therefore the ones displayed in the launcher."
you can refer the link also...
http://developer.android.com/guide/topics/manifest/manifest-intro.html

Update the project name in Eclipse

How can I update the project name in Eclipse?
I have changed the project name by using "refactor" and "rename", but when I install the .apk in my device, it still shows the old project name.
How can I fix it and what is the problem?
Project name got nothing to application name. And there's no really anything like one application name on Android, but the label of Activity (one or more) user can access from his launcher. This is declared in AndroidManifest with android:label for every Activity with proper intent-filter.
<activity
android:name=".StartActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
See docs.

Android - Is it possible to get two different apk just by cleaning the project?

I use the same source to make apk files.
But I found that I get the different apk files just because of cleaning the project.
Why I think I got two different apk files, I try to change locale, one apk got the language changed, and one is not.
I think there might be something wrong in my "AndroidManifest.xml" file.
Could this kind of thing happen?
i think you got two app launcher ... pls check your manifest file for this..
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
And this should be declared only once in manifest.. check any duplicate is there?

Cant scan QR codes with ZXing

I'm really new in Android Development and, like many others, I'm trying desperately to integrate ZXing into my project. I have to make a stand-alone QR scanning application for Android. (I'm using the 2.3.3 sdk).
I have to explain that I've already tried to find a solution to my problem by reading all the answers about the topic but I haven't suceed at all.
Here is what I've done:
I downloaded the ZXing 2.0 Release from here
Then, I added the assets, src and res to my project simply by dragging the files into my
project.
I referenced the core.jar archive located in the "core" folder by right-clicking in my
project > Build Path > Configure Build Path. I add ir as an External JAR.
This is a image to ilustrate.
In here, I was getting some errors in the ID's and some other resources. That was
happening because I was referencing to que wrong R.java, so I solved that by changing "import com.google.zxing.client.android.R" to "import com.android.novaqr.R", which is my projects
package.
Then I added:
<uses-permission android:name="android.permission.CAMERA"/>
and
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
to the AndroidManifest.xml
So now I have no errors in my code and here is where i need help: I need the phone to scan when I push a button. I've tried a lot of solutions that I saw on the other questions about this topic, but I haven't succeed.
I hope I'm clear with my question, if not, let me know and I'll try to be more specific
Any help will be really apreciated.
You are strongly discouraged from completely copying and pasting our app. It sounds like you're not experienced enough in Android to use it this way anyway.
Instead, you can use the app's scanning service by Intent, which is far easier and supported: http://code.google.com/p/zxing/wiki/ScanningViaIntent

Categories

Resources