Well, I got this issue because my project was imported from Eclipse to Android Studio and dependencies were missing in gradle.
I got rid of it after adding
useLibrary 'org.apache.http.legacy'
in
defaultConfig { }
below
targetSdkVersion 25
After, this I had to set
minSdkVersion 9
Also, I added following lines
aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false
above
defaultConfig { //code snippet }
So, that it looks like,
android { compileSdkVersion 25 buildToolsVersion '25.0.2' aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false defaultConfig { applicationId "xxx.xxxx.xxxx.xxxx" minSdkVersion 9 targetSdkVersion 25 useLibrary 'org.apache.http.legacy' compileOptions { sourceCompatibility JavaVersion.VERSION_1_5 targetCompatibility JavaVersion.VERSION_1_5 } //remaining code snippet //..... } //remaining code snippet //..... }
@tompok, you are getting this error maybe due to jar files you are using in dependencies may not be there.
Instead Google for their gradle dependencies and place the package name in place of path like it is in first line:
compile 'com.android.support:support-v4:19.1.0'
Replace remaining dependencies in the above format.
Hope, it will help you.
______________________________________
EDIT:
You are facing this problem since you are using buildToolsVersion 25.0.2
whereas library you are using is compile 'com.android.support:support-v4:19.1.0'
Just change it to compile 'com.android.support:support-v4:25.0.2'
and your issue will be solved.
Ask if you face any other issue else accept it as answer so it may help others.