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>
Read More:
- [Solved] Android Error: import android.support.annotation.NonNull
- [Solved] Android app development version update failed, Android – error: task execution failed ‘: app: com
- [Solved] Android9.0 App Install Android4.4 Error: InflateException-You must supply a layout_height attribute.
- [Solved] Android 9.0 APP Install Android 4.4 Error: IllegalArgumentException
- JZVideo Error: Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference
- [Solved] GBase 8a V95 Replace Node Error: single vc mode does not support ‘–freenode’
- [Solved] error: package android.support.design.widget does not exist
- [Solved] Android Studio Start Error: Missing essential plugin: org.jetbrains.android Please reinstall Android
- How to Solve Error inflating class android.support.design.widget.FloatingActionButton
- [Solved] Hadoop Error: Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
- Android7.0+ Failed to Share Images: exposed beyond app through ClipData.Item.getUri()
- [Solved] Android Error: Execution failed for task ‘:app:mergeReleaseNativeLibs‘.
- [Solved] Android Studio Compile Error: Execution failed for task ‘:APP_MIDI:lintVitalRelease‘.
- Android studio Error:Execution failed for task ‘: app:transformResourcesWithMergeJavaResForDebug ‘
- [Solved] :app:processDebugResources Android resource linking failed Android resource linking failed
- Remember an android app startup error Error running: Default Activity not found
- Download and save uniapp pictures to Android error reporting app
- [Solved] Failed to apply plugin appears when Android studio imports a project
- [Solved] Android Studio Error: Error:Execution failed for task’:app:mergeDebugResources’