Tag Archives: import android.support.v4 (V7). App.activitycompat

[Solved] Android Project error: import android.support.v4 (V7). App.activitycompat

this is Chapter 18 of Android tutorial series. If you find it useful, you are welcome to follow the column

I: problem description

I got an Android project in 2018. The error message of a java file in the project is as follows

Error 1: Import android.support.v4.app.activitycompat

error 2: Import android.support.v7.app.appcompatactivity

The exception occurred when introducing Android support, because most Android projects now use Android x to replace the past Android support library, but it depends on the demand. Let’s talk about how to solve this problem on older Android projects.

II: solution

For error 1, copy the following line of code to replace the error reporting code

import android.support.v4.app.ActivityCompat;

For error 2, copy the following line of code instead of the error reporting code

import android.support.v7.app.AppCompatActivity;

Has your problem been solved? Welcome to leave a message in the comment area.


 

Conclusion

technology is accumulated bit by bit, and the great God can not be achieved in a day. Standing still is a step back, so make progress a little every day

finally, I attach a motto: “if you are eager to learn, if you are hungry, if you are humble, if you are stupid”. I hope we can encourage each other</ font>