Tag Archives: Android

Using Fiddler to capture mobile app

Use Fiddler to capture mobile APP package detailed tutorial
There were two very difficult problems in the process of grasping the package in the mobile APP with Fiddler. One was that the phone could not connect To the network after setting the proxy, and the download certificate on the phone always indicated that the download failed. The other was that the information of grasping the package on the Fiddler was all displayed as Tunnel To. It took a long time to solve, and now share it to let some novices walk less detours, maybe my method can solve your problem, may not solve it, but also provide a way to try.
To set the fiddler
1. Download Fiddler from the website and install it. https://www.telerik.com/download/fiddler
2. First configure Fiddler, open Fiddler, and then click Tools –>; The Options… – & gt; HTTPS, check and install the certificate as shown in the installation diagram.


3 4.

3 4.

3 4 Click the OK button to close Fiddler and reopen it again. At this point, the Fiddler part is set up in the normal way, followed by some Settings on the phone.
5. Here I use millet portable WiFi, mobile phone connected to millet portable WiFi, so that the phone and computer connected is the same network segment.
Set the cell phone
6. Go to the WiFi Settings page on the mobile phone, change the agent to “Manual”, and the hostname is the IP address

after the computer is connected to the WiFi network. Open the mobile browser, enter the address open http://ipv4.fiddler:8866, (because I set the port number is 8866), click in the page FiddlerRoot certificate, certificate of download. I have encountered a problem here, is the certificate can not download, keep telling download failed. Up to now, I have encountered two problems that are difficult to solve. One is that the download certificate in the webpage fails to download; the second is that after opening the APP on the mobile phone, all the packages caught in Fiddler are displayed as Tunnelto. Now, how do I solve these two problems
Solution to the problem:
1. Download Cermaker from the Fiddler website, download it and run the plug-in.
download address: https://www.telerik.com/fiddler/add-ons

2. After the installation, we found that the TunnelTo problem was still not solved, and there is a new problem. On the mobile phone, open http://ipv4.fiddler:8866, instead, it shows No Root Certificate was found.Have you enabled HTTPS traffic decryption in fiddler yet?
3. So I tried the following solutions.
makecert.exe-r-ss my-n “CN= do_not_trust_fiddlerRoot, O=DO_NOT_TRUST, OU=Created by http://www.fiddler2.com “-Sky Signature -EKU 1.3.6.1.5.5.7.3.1-h 1-cy Authority -a sha1-m 120-b 09/05/2012
If you want to run the fiddler, you can restart the fiddler
4. Then open http://ipv4.fiddler:8866 in the browser on the phone, download the certificate, download and install it successfully, open the test APP, and find that the packet was captured successfully. HTTPS can catch the packet normally, but HTTP still shows Tunnel to, but it does not affect the use.

Get the startup activity of Android apk

Get the Start Activity for Android APK

adb connect phone open APP

adb -s 192.168.0.11:6688 shell dumpsys window Windows | grep “mCurrent” # gets the package name of the current APP

adb shell dumpsys activity > Act.txt # gets the activity information
# on the act. TXT find android. Intent. The category. The LAUNCHER behind the name of the activity is to start the activity
Adb -s 192.168.0.11:6688 shell am start – n com. Dragon. Read/pages. Splash. SplashActivity #

Command not found: ADB appears on Mac

Method one:

    open the MAC terminal, enter CD ~ enter touch.bash_profile [if you don’t have .bash_profile , create this file] enter open.bash_profile [open the file we created, a text edit box should pop up, if this is the first time to configure the environment, Write the following code in the open text editor:
• export ANDROID_HOME=/usr/local/opt/android-sdk
• export PATH=${PATH}:${ANDROID_HOME}/tools
• export PATH=${PATH}:${ANDROID_HOME}/platform-tools
    note that in [4] ANDROID_HOME should be filled in according to its own SDK path, the rest can be copied directly. As for the SDK path, you can open Android Studio and view in the Preference [Android SDK] and enter source.bash_profile in the terminal and enter adb [verify that the configuration is complete and if not show adb: command not found that the configuration is complete]

Method 2:

    make sure whether to install the adb, /Library/Android/SDK/platform - the tools/adb if there is, if there is a skip the following steps, directly to the last step 5; Open [Android Studio]; Open the SDK Manager check 】 【 SDK Platform - the Tools), run the following command on the Mac
    echo export "PATH = ~/Library/Android/SDK/Platform - the Tools: $PATH" & gt; > ~/. Bash_profile
    6. Restart the terminal

after completing the above steps
Note: if ZSH is used, replace .bash_profile with .zshenv
Quote from: https://stackoverflow.com/questions/10303639/adb-command-not-found/45063101#45063101?newreg=f632609fe6154f9580a49153cb0387e5

Modifying the default style of scrollbar in Android

Well, I met the requirement again, and needed to modify the style of ScrollBar, so I looked up a lot of documents, I think the summary of this great cow is good, by the way, I took a look at his home page, wow, great ~!! Attach great god article links: http://likfe.com/archives/

knowledge points in the ListView/ScrollView/RecyclerView add attributes:
android: vertical scrollbars = “”
android: scrollbarTrackVertical =” @ drawable/xxx_vertical_track “
android: scrollbarThumbVertical =” @ drawable/xxx_vertical_thumb “
B: Horizontal scroll bar
android: horizontal scrollbars = “”
android: scrollbarTrackHorizontal =” @ drawable/xxx_horizontal_track “
android: scrollbarThumbHorizontal =” @ drawable/xxx_horizontal_thum “
other common attributes
defines the style and position of the scrollbar
android:scrollbarStyle= “outsideInset”
2. Define the size of the scroll bar, refers to the width, when the vertical level refers to the height of the
android: dp scrollbarSilbarSize = “4”

0

2

4

5

6

8

attributes effects
1 scrollbarThumbVertical[Horizontal] 3 short bars
7 scrollbarTrackVertical[Horizontal] 9 long bars, The background
Note that
where scrollbaTrackxxx, scrollbarThumbxxx can use:
◦ custom Shape

◦. ◦ can be registered for use.9. PNG
@color/ XXX to use color values
You cannot use the # XXXXXX color value directly
Android :scrollbarStyle can define the style and position of the scrollbar with four optional values including insideOverlay, insideInset, outsideOverlay and outsideInset.
Where inside and outside respectively mean whether the overlay is inside the padding of the view, overlay and inset mean whether the overlay is on the view or inserted behind the view, so the four values respectively represent:

0

3

4

6

attribute value effect of the

insideOverlay

default values, Inside the padding and overlaid on the view
means inside the padding and inserted behind the view
outsideInset 1 means outside the padding and inserted behind the view
5 outsideOverlay 7 inside the padding Outside and overlying the view

Demo
note:
scrollbarTrackVertical can be set to transparent or not directly set android: scrollbarTrackVertical = “@ color/transparent”
again: scrollbarThumbVertical, scrollbarTrackVertical can not directly set to color values, but you can use @ color
Layout:

android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
android:scrollbarSize="3dp"
android:scrollbars="vertical"

Demo 2
layout:

android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="@color/red_square"
android:scrollbarSize="3dp"
android:scrollbars="vertical”

default:

Demo2 effect:

Demo1 effect:

Change API level Android studio

Changing API Level Android Studio
I want to change the minimum SDK version in Android Studio from API 12 to API14. I have tried changing it in the manifest file, ie, I want to change the minimum SDK version in Android Studio from API 12 to API14. I tried to make the change in the manifest file, which is

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="18" />

and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. and rebuild projects, but I still get the Android Studio IDE throw out some mistakes. I presume I have to set the min SDK in ‘project properties’ or something similar so the IDE recognizes the change, But I can’t find where this is done in Android Studio. I think I have to set the min SDK in project properties or something similar so that the IDE can recognize changes, but I can’t find anything done in Android Studio.


# 1/f,
Reference: https://stackoom.com/question/1JfkP/ change the Android API level – Studio


# 2 floor
For me what worked was: (right click)project-> android tools-> Clear lint markers. , for me, markers that have worked are :(right click) markers -> The android tools – & gt; Remove lint marks. Although for some reason the Manifest reverted to the old (lower) minimum API level, But after I changed it back to the new (higher) API level there was no red error underline and the project now USES the new minimum API level. although for some reason the list has been restored to the old (lower) minimum API level, But after I changed it back to the new (higher) API level, there was no red error underscore, and the project now USES the new lowest API level.
Edit: Sorry, I see you were using Android Studio, not Eclipse. Edit: Sorry, I see you are using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere , which I think might be able to solve the problem.


The # 3 floor
As well as updating the manifest, update the module’s build.gradle file too (it’s listed in the project pane just below the manifest – if there’s no minSdkVersion key in it, you’re looking at the wrong one, Gradle build. Gradle file for the module (list this file in the project pane at the bottom of the list – if there is no minSdkVersion key in it, then you have entered the wrong key because there are several). A rebuild and things should be fine… rebuild, everything should be fine…


# 4 floor
When you want to update your minSdkVersion in an existent project… when you want to update your minSdkVersion in an existing project…

    Update build. Gradle (Module: app)-make sure is the one under gradle 4 build and it is NOT build. Gradle (Project: yourproject) Update build. Gradle (Module: app) App) - make sure it's the one under Gradle Script, not build. Gradle (Project: yourproject).

An example of build.gradle: build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"

    defaultConfig {
        applicationId "com.stackoverflow.answer"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
    androidTestCompile 'junit:junit:4.12'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
    Sync gradle button (refresh all gradle projects also works) synchronous gradle button (refresh all gradle projects can also work)

For beginners in Android Studio "Sync gradle button" is located in Tools -> Android -> Sync Project with Gradle Files "Rebuild project" Build -> Rebuild Project for beginners in Android Studio, the "sync gradle button" is located in the tool -> Android-> Use Gradle file to synchronize the project "Rebuild Project" build-& gt; Rebuild Project

    Rebuild project Rebuild project

After updating the build.gradle 's minSdkVersion , You have to click on the button to sync gradle file (" sync Project with gradle files"). update build. After gradle minSdkVersion, you must click on the button gradle sync file (' sync Project with cradle files'). That will clear the marker. this will clear the marker.
Updating manifest.xml, for eg deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio. ; Updating manifest.xml is NOT necessary. For example, remove any references to the SDK level in the manifest file.


The # 5 floor
For android studio users: For android studio users:

    right click the App directory right-click App directory choose the "module setting" option select "module Settings "option change the ADK Platform as what you need0 1 change the ADK Platform 2 3 click Apply click Apply

The gradle will rebuild The project automatically. gradle will automatically rebuild The project.


# 6 building
According to this answer , you just don't include minsdkversion in the manifest.xml, And the build system will use the values from the build.gradle file and put the information into the final apk. according to this answer, you only need to include minsdkversion in the manifest.xml, the build system will use the values in the build.gradle file and put the information into the final apk.
Because the build system needs this information anyway, this makes sense. Because the build system still needs this information, so this makes sense. You should not need to define this values two times. You do not need to define this values twice.
You just have to sync the project after changing the build.gradle file, But Android Studio 0.5.2 display a yellow status bar on top of the build. Gradle editor window to help you you only need to synchronize the project after changing the build. Gradle file, But Android Studio 0.5.2 displays the yellow status bar at the top of the build.gradle editor window to help you
Also note there at least two build. Gradle files: one master and one for the app/module. Also note that there are at least two build. Gradle files: one main file and one file for the application /module. The one to change is in The app/module, it already includes a property minSdkVersion in a newly generated project. to change is in The app/module, It has already included the attribute minSdkVersion in the newly generated project.

Android avoids memory leak: reasonable use of getcontext() and getapplication ()

To conclude:
GetApplicationContext () can fetch the Application object, and getContext() is generally considered to return an Activity object (which, of course, is not actually limited to the Activity). 2. For Application, you can see from the Manifest file that an Application typically has only one Application node. Application is just an Application, that is, as long as the current Application is still running, it can get to the Application object. 3.Application is a long reference, and Activity is a short reference. Application is suitable for storing objects that need to be read repeatedly, such as the user’s username and password, the current Settings of the Application, and so on. When an Activity is applied to the current active form, such as displaying a Dialog, or creating a new View, the context object passed in should be the current Activity, not the Application.
    
Android applications limit heap memory to 16M (note: heap memory is also related to device performance; available heap memory for high performance devices may be 24M or more), with phone functions taking up a portion of the heap and developers having very limited access to it. If you’re not going to run out of memory, your application should use as little as possible so that other programs don’t get killed when they run. The more applications the Android system can hold in memory, the faster users can switch between applications. As part of my work, I researched memory leaks in Android applications and found that most of the time it was the same problem: holding a long reference to the Context.
In Android, Context is used for many operations, but mostly to load or access resources. This is why all Widget components receive a Context parameter in the constructor. For a typical Android Application, there are usually two contexts, namely Activity and Application. Developers often need the context to select an Activity when passing between classes or methods.

this indicates that Views have a reference to the entire Activity, so anything in your Activity will be held by Views, which are generally held by the view hierarchy and its corresponding resources. So, if you give away the Context, you’re giving away some memory. If you’re not careful, it’s very easy to reveal an Activity.
when the screen direction changes, the system will save its state by default, destroy the current Activity, and create a new one. To do this, Android reloads the application’s UI from resources. Now let’s say you’re developing an app that contains a lot of bitmaps, and you don’t want to load bitmaps every time you switch screens. So the easiest way to do this is to use the static static field.

How to Root the Samsung Galaxy Note 2 (GT-N7100)

http://theunlockr.com/2013/04/06/how-to-root-the-samsung-galaxy-note-2-gt-n7100/#!

So you have just picked up the Samsung phablet — Galaxy Note 2 — and wondering if you could have root-access on it so you can unlock the true potential of it?You’re in luck. Chainfire, a known name in Android industry, has come up with a root method for the device and this guide shows exactly how you can use it to root your Samsung Galaxy Note 2 device. After rooting your device, you’ll have access to hundreds of root-only apps available in the store as well as you can flash a custom recovery and enjoy custom ROMs. But before doing any of these, you need to root your device so get onto the procedure below and do that first.
I. Before You Begin:
1. This will void the warranty of your device. However, you can reinstate the warranty by unrooting your device if there’s any unrooting procedure available.
2. You should have a Windows based PC to do this procedure.
II. Downloading Required Files:
1.  CF-Root (Download link’s available in the third post)
2.  Odin (It’s attached in the second post)
III. Rooting the Samsung Galaxy Note 2 (GT-N7100):
1. Place both the files you downloaded to your Desktop.
2. Unzip files from both the archives to your Desktop.
3. Launch the Odin tool by double-clicking on its executable file available on your Desktop.
4. Click on PDA and select the CF-Root file you extracted earlier from the archive.
5. Make sure that the Repartition box isn’t checked.
6. Turn OFF your device
7. Reboot your device into Download mode. To do that, press and hold the Volume DOWN+Home+Power buttons together.
8. Once inside Download mode, connect your device to your PC via USB cable.
9. Hit Start button in the tool and it’ll start flashing the file.
10. You should be rooted once the file’s been flashed!
11. You’re done!
Awesome! Your Galaxy Note 2 phablet has been successfully rooted and is ready to be loaded with some cool root-only apps!
IV. Flash a Custom Recovery Image (Optional):
1.  If you would like to flash a custom recovery image in order to flash custom ROMs, head to the How To Flash a Custom Recovery Image on the Samsung Galaxy Note 2 (GT-N7100) to learn how to do that.
Image Credit: CNET
If this procedure helped you please thank/donate to the original developers here.
If you need help with this procedure, please ask in the comments below or in the forum.
This is part of our Android How To’s. We have how to’s on rooting, loading ROMs, and tons of other tips and tricks for your specific device or for Android devices in general! For all of our Android How To’s, head here.

Read more at http://theunlockr.com/2013/04/06/how-to-root-the-samsung-galaxy-note-2-gt-n7100/#jRMbk01XZcZc6VyR.99 

Android studio push project to GitHub

Introduction :Android Studio itself supports Github. So it’s easy to push direct code onto Github.

Prepare _ configuration account
Import the Git
Settings -> Version Control -> Set Git directory

Set up Github
After setting, click Test to Test.

Prepare 2_ create project
Create the As project

Create Github’s repository

Add Git management to the As project


Add the address of the Push
1. Right mouse button in the testProject created = “gitBash

Add Git management to files in your Git directory

Then commit

Then push


OK
If all goes well, you can see that the document was submitted successfully.

To solve this problem, we can’t find the solution of / storage / emulated / 0 / file. I can’t. You can try this

Open Device File Explorer-& GT; Locate the MNT folder -> Find the SDCard folder -> Find storage – & gt; Find your file in turn (add it if you don’t have one) -> Just put the full path in your code.
eg:

String sdpath = Environment.getExternalStorageDirectory()
                    .getAbsolutePath();
filepath = File.separator + "mnt" + File.separator + "sdcard" + sdpath + File.separator + "movie.mp4";

You must restart ADB and eclipse

In Eclipse, when debugging an Android project, the following information appears:

The connection to adb is down, and a severe error has occured.

You must restart adb and Eclipse.

Please ensure that ADB is correctly located at

Open the process manager, there will be *adb.exe process, because I opened the cool dog to listen to music, so kadb.exe process appears, close it, and type adb Start-up server in the command window; With successFuly displayed, you find that you are ready to debug. After restarting Cool dog, the debugging failed, so kadb. Exe was deleted from the installation path of Kugou (cool dog can still listen to music), and the debugging will not be disturbed by cool dog in the future.  

Android in the Studio, in the debug Android project, if the pop-up
adb is not responding. You can wait more, or kill “adb. Exe” process manually and click ‘Restart’
indicates the adb (adb) response to failure, open a command window, Enter netstat -aon|findstr "5037" (adb needs to use this port), you can find the PID(right-most number) that takes up this window, open task manager, select the “process” TAB, click “view – select column” in the TAB bar, tick “PID(process identifier)”, and click ok. You’ll see that each process displays its PID. Find the corresponding process number and close the process. Just restart AS.

Android studio disable install run

Recently, I have been trying to access Tencent’s hot fix solution -Tinker in the project
After clone the sample on Github, I would like to run it on the virtual machine. The error is as follows:

Tinker does not support instant run mode, please trigger build by assembleDebug or disable instant run in 'File->Settings...'.

So go ahead and disable install Run,
Version information:

Android Studio 3.2
Build #AI-181.5540.7.32.5014246, built on September 18, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

The menu bar – & gt; Android Studio -> The Preferences… -> Then it is shown as follows:

And then uncheck the red box,
apply -> ok
Finished!

Android studio “sync project with gradle files” button disappears

In the process of using Android studio today, I suddenly found a project error. The sync project button appeared and disappeared. My confusion was over.

1.Sync project with Gradle Files button disappears, app mark Red Cross

2. There is nothing in android project area, have I deleted modules?
?
?