Tag Archives: Android

com.android.ddmlib . adbcommandrejectedexception: device offline error while installing APK solution

com.android.ddmlib .AdbCommandRejected Exception:device offline

Error while Installing APK

 

The problem is that the ADB has been killed. Just restart it

There are three ways:

1、 You can find Plattform tools in the SDK file, and you can find ADB, in this folder

double click the ADB to restart

 

2. You can also perform two-step command operations in CMD: 2

1、adb kill-server

2、adb start-server

 

3、 Restart the computer


The above is reprinted content

Personal supplement: I tried the first method, which is effective, and the result is effective and invalid when it runs again. Finally, it was found that the interface of the mobile phone was in poor contact, resulting in a sudden drop of the line during operation.

Episode: when searching for this question, the comments asked the original blogger if he could reprint it. Because he didn’t receive a reply immediately, he temporarily sent an original article. Today, some people like it. I just saw that the original blogger replied that it could be reproduced soon. Let’s make it up today.

java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView

reward: java.lang.IllegalStateException ArrayAdapter requires the resource ID to be a TextView & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &

at Android.widget.ArrayAdapter .createViewFromResource( ArrayAdapter.java:437 ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ ♪ I love you ♪ Android.widget.ArrayAdapter .getView( ArrayAdapter.java:407 )

:: :: :: :: :: :: :: :: at Android.widget.AbsListView .obtainView( AbsListView.java:2372 )

:: :: :: :: :: :: :: :: at Android.widget.ListView .makeAndAddView( ListView.java:2052 )

I’m sorry, I’m sorry. Android.widget.ListView .fillDown( ListView.java:786 )

There’s one problem:

ArrayAdapter<String> adapte = new ArrayAdapter<String>(
  SiteActivity.this,android.R.layout.simple_list_item_2,site
);

I will be simple_ list_ item_ Change 2 to simple_ list_ item_ 1 will solve the problem and will not report an error

Refer to the causes of the problem: https://blog.csdn.net/xxg3053/article/details/6999872

“Failed to convert @ drawable / XX into a drawable exception details are logged in window”

Problem description

Image resource reference error, there are usually the following similar error logs:

java.lang.NumberFormatException: Color value 
'@drawable/xx' must start with #

reason

The most likely cause of this problem is that your image resource name is wrong, and it is likely to start with a number. In Android, if your image is named after a number, the system will treat it as a hexadecimal color value by default, and the definition of these color values often starts with “#”, so there is the following numberformatexception.

Solution

At this time, you need to check whether the name of the wrong resource starts with a number. If it starts with a number, rename it. If not, try to check whether the name of the resource starts with a space in eclipse (of course, the error at this time is that the drawable file cannot be found). If so, modify it. If not, delete the image and add it again.

After renaming, if the layout file cannot be displayed normally, refresh the preview of the layout view or restart the development tool.

Duplicate class com.xxx.xxx Find in modules problem solving (Aidl interdependence problem)

1. Usage scenarios:

A (with Aidl) AAR; B (with Aidl) AAR depends on a;

C (APP) relies on a and B AAR libraries

At this time, both a and B have the same Aidl interface class to report the above error!

2. Problem solving

B (Aidl) AAR depends on A. you can remove the Aidl interface class in class B.

Android error java.lang.IllegalStateException : System services not available to Activities before onC

The full error log is as follows:

 FATAL EXCEPTION: main
                                                 Process: com.example.administrator.followview, PID: 8587
                                                 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.administrator.followview/com.example.administrator.followview.MainActivity}: java.lang.IllegalStateException: System services not available to Activities before onCreate()
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:148)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                  Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
                                                     at android.app.Activity.getSystemService(Activity.java:5253)
                                                     at com.example.administrator.followview.MainActivity.<init>(MainActivity.java:18)
                                                     at java.lang.Class.newInstance(Native Method)
                                                     at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

The error code is as follows:

public class MainActivity extends Activity implements View.OnTouchListener {
    private Button mButton;
    private ViewGroup mViewGroup;
    private int xDelta;
    private int yDelta;
    WindowManager wm = (WindowManager) this
            .getSystemService(Context.WINDOW_SERVICE);

    int width = wm.getDefaultDisplay().getWidth();
    int height = wm.getDefaultDisplay().getHeight();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mViewGroup = (ViewGroup) findViewById(R.id.root);

Sure enough, it’s written on oncreate. Just put it into the oncreate method to run.
 

Prompt “namespace ‘app’ not bound” when compiling Android studio

Prompt “namespace ‘app’ not bound” when compiling Android studio

The problem is that the root node is missing a declaration.

xmlns:app= " http://schemas.android.com/apk/res-auto "

Original:

<?xml version=”1.0″ encoding=”utf-8″?> <menu xmlns:android= ” http://schemas.android.com/apk/res/android ” >

Change to:

<?xml version=”1.0″ encoding=”utf-8″?> <menu xmlns:android= ” http://schemas.android.com/apk/res/android ” xmlns:app= ” http://schemas.android.com/apk/res-auto “>

 

Can

Android “handler” is abstract; can’t be identified solution

Today, when I use Android’s own refresh control, I need a handler for instance calls, but I report an error in my own instance calls
“handler” is abstract; can’t be identified
because there is an error in my import library. I use Android’s handler library instead of Java’s handle library
the solution is as follows
use “import” to import android.os.Handler ; ”Replace “import” java.util.logging .Handler;”

This can be solved, in addition to the reference to this blog

Android Studio could not resolve resource

Refer here: http://blog.csdn.net/dong19870625/article/details/50833433

Original text:

In the development project, the XML file suddenly appears
couldn’t resolve resource @ color / title_ The color (58 similar errors not show) problem caught people off guard. It’s no problem to write the color and other resource files directly, but it’s not the fundamental solution to the problem

Android Studio just gets crazy. But a restart ain’t always enough.

Invalidate your caches and restart.

File -> Invalidate Caches / Restart… -> Invalidate and Restart

According to the above practice, the effect is good, solved my problem, the original as itself also has cache

reference resources: http://stackoverflow.com/questions/8390733/relativelayout-couldnt-resolve-resource-android

———————————————

I also met similar, but I can’t find the relevant style. It can’t be displayed normally in the preview, but it runs normally. No matter refresh or rebuild, it can’t be eliminated. Just follow the above procedure

Android artifact xposed framework user guide

1 Introduction

Xposed is known as the most powerful artifact on Android. If you don’t know what xposed is, then you are really out. This blog will let bloggers take you to understand xposed.

(1) What is xposed?
Xposed is a framework. There are many modules on it. These modules all depend on xposed. The reason why xposed is the first artifact is that these modules can complete many incredible functions, such as modifying the wechat interface, automatically grabbing red packets module, self defining the text of the program, preventing wechat messages from withdrawing, and preventing the three hooligans of bat from calling each other Wake up, chain start, lock the screen automatically after the app to prevent background operation power consumption, there are many modification app or mobile data installed B module and so on.

(2) How does xposed work?
xposed The principle is to modify the key files of the system, and then when the app calls the system API, it first goes through xposed, and these xposed based modules can selectively do some “bad” things when the app calls these APIs, or modify the returned results, so that the effect of the app will change when it runs, but the app itself is not damaged, just when it calls the system API Wait, the performance of Android system has changed. This is hook, the technical term hook. So, to put it bluntly, xposed is a powerful hook framework.

Let’s have a professional explanation

By replacing / system / bin / APP_ The precess program controls the zygote process so that it loads a jar file of the xposed framework during the system startup XposedBridge.jar So as to complete the hijacking of zygote process and its Dalvik virtual machine, and allow the development