I am new to android development, and I have been using the command line tools to create an android project. I followed all the instructions given in the tutorial at android
First of all check if your project is using androidx or android support library. Check gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
If it contains the above lines, it is using androidx with an old code from some old tutorial.
In build.gradle (module:app)
Use
implementation 'androidx.appcompat:appcompat:1.0.0'
Instead of
compile 'com.android.support:appcompat-v7:28.0.0'
Also in MainActivity.java : Use
import androidx.appcompat.app.AppCompatActivity;
instead of :
import android.support.v7.app.AppCompatActivity;
Switching to AndroidX helped me:
import androidx.appcompat.app.AppCompatActivity;
try to copy C:\Program Files\Java\jdk1.8.0_121 && C:\Program Files\Java\jre1.8.0_121 from other working PC then all (clean && rebuild)
After Rebuild the project issue resolved..