Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol NameValuePair

Tags:

In my project I got an error:

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

Then I tried to fix it use this:

compileSdkVersion 23 

But then I got error:

cannot resolve symbol NameValuePair android

How to fix this error?

like image 896
g8214435 Avatar asked Aug 20 '15 14:08

g8214435


2 Answers

If you want to use NameValuePair or BasicNameValuePair in android studio with latest API Levels. Then follow steps below:

  • Open build.gradle(Module) file and copy these dependencies:

    implementation 'com.google.http-client:google-http-client-android:+'  implementation 'com.google.api-client:google-api-client-android:+'  implementation 'com.google.api-client:google-api-client-gson:+' 
  • Copy useLibrary 'org.apache.http.legacy' below buildToolsVersion like:

    android { useLibrary 'org.apache.http.legacy'} 

Thats all. Now just sync gradle file.

Note: In dependencies i recommend to use latest version of libraries instead of + symbol.

like image 148
Rahul Sharma Avatar answered Sep 23 '22 01:09

Rahul Sharma


NameValuePair is part the package org.apache which was deprecated with Android 22 and removed with Android M, which is the version against you are compiling. What is interesting is that neither the documentation of NameValuePair is reachable

like image 44
Blackbelt Avatar answered Sep 23 '22 01:09

Blackbelt