Android studio cannot resolve symbol after R.xxx - android

I am using android studio 2.1.2
studio not resolving symbol like id,layout,mipmap,anim ..
I have tried Invalidate cache/restart , sync project with gradle, clean project, rebuild project but none of above working please help me..
Screenshot:
this are my imports
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import java.util.ArrayList;
import java.util.List;
event log
2:17:33 AM Gradle sync started
2:18:00 AM Gradle sync completed
2:18:01 AM Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]
2:18:10 AM Gradle build finished in 10s 125ms
2:20:46 AM Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
2:22:06 AM Gradle build finished with 66 error(s) in 1m 20s 297ms
2:23:16 AM Gradle sync started
2:23:38 AM Gradle sync completed
2:23:49 AM Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]
2:24:52 AM Gradle build finished in 1m 12s 945ms

I can't belive it i have defined int R and it causes error i have removed it problrm solved you know why thank you guys for being kind!!!!

Related

FirebaseRecyclerOptions throwing error

I have added import import com.firebase.ui.database.FirebaseRecyclerAdapter; and
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile'com.firebaseui:firebase-ui-database:1.1.1'
in my grade files
Still, I am unable to use FirebaseRecyclerOptions
Thanks in advance :)
Gradle dependencies

How I import this package in android?

I want to import this
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
My Libirary path is C:\Program Files\Android\Android Studio\jre\jre\lib
But Package Location is C:\Users\mell\AppData\Local\Android\sdk\platforms\android-25
How I change this path in android?
Packages->Library->org This is Location
Add this inside the android{...} block inside your module level build.gradle:
useLibrary 'org.apache.http.legacy'

LocationRequest and LocationServices.API are not resolved

I have a high priority project under development.
I am trying to insert geo location into db so I found a service online and unfortunately LocationRequest and LocationServices.API are not resolved.
I am using the dependency 'com.google.android.gms:play-services-maps:10.2.0'
I tried adding the imports
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
You can find the code I used at this link
Seems like you need to compile the play-services-location package.
Put these into the build.gradle
ext {
playServicesVersion = '10.2.0' // update accordingly
}
dependencies {
...
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile "com.google.android.gms:play-services-location:${playServicesVersion}"
}
Try this
implementation 'com.google.android.gms:play-services-location:15.0.1'
in your app.gradle, and update the version regularly.
Try this implementation 'com.google.android.gms:play-services:12.0.1'
worked for me

com.google.android.gms.drive.DriveApi.ContentsResult cannot be resolved... But everything else can be?

I'm getting this error:
com.google.android.gms.drive.DriveApi.ContentsResult cannot be resolved
But just with that one import. These all work:
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.drive.Contents;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.drive.DriveFile;
import com.google.android.gms.drive.DriveFolder.DriveFileResult;
import com.google.android.gms.drive.MetadataChangeSet;
And for some reason ContentsResult can't be found. Even doing this works:
import com.google.android.gms.drive.DriveApi.*;
And it works in the sense that it doesn't error on the import, but when I do that, ContentsResult still just cannot be found...
Has anyone had this issue before?
There is no ContentsResult class in the DriveApi package, but there is a DriveContentsResult class:
com.google.android.gms.drive.DriveApi.DriveContentsResult
See http://developer.android.com/reference/com/google/android/gms/drive/package-summary.html
The answer 'myanimal' gave you is correct. You are probably using some older version of GDAA code, since 'ContentsResult' used to be there see here. Please make also sure you are compiling with the latest 'play-services:6.5.87'. I'm not sure it you are using Android Studio. If yes, see if your 'build.gradle' config file has the dependencies right:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
....
....
}
Disclaimer: It is not a 'better' answer, just an extension of "myanimal's" answer below.

intellij- cannot resolve symbol 'support'

I am new to intellij13 and just imported my Android project into it. however get the following errors and tried adding dependencies but cannot work.
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.TextView;
those are my imports
Going out on the limb here, but you probably need to add android-support-v4.jar to your project dependencies (in the /libs folder). If you are using Gradle, then add:
dependencies {
compile 'com.android.support:support-v4:19.1.+'
compile 'com.android.support:appcompat-v7:19.+'
}
in your build.gradle file

Categories

Resources