I can not get any android classes to autofill in android studio. All of the android classes appear red ('cannot resolve symbol/method') and there is also no option for me to import class. If I manually enter the code to import the individual classes and compile my code it will run fine, however this is really annoying.
I have tried to 'Invalidate caches/restart'as suggested in other posts but this does not fix my issue. I have also checked updated everything in the android sdk as well as tried reinstalling android studio but nothing has worked.
Thanks for your help.
Related
Android Studio v3.2.1, SDK 28
All worked fine yesterday but then the layout previews stopped working (saying layout_width and layout_height) undefined. Eventually reinstalling fixed that but now I've getting problems with some imports not being recognized (android.view.View, java.util.List, android.app.Activity) but most are still OK (android.view.Display, java.util.Map etc.)
Also saying it can't find the Default Activity now although manifest is unchanged and MAIN/LAUCHER are present
Tried invalidating the cache and restarting, reinstalling studio, resyncing with gradle, reinstalling APK, cleaning project but error persists. I do remember updating the android emulator around the time the errors started but not sure why this would affect the editor.
Image:
import android.view.Display;
import android.view.View; // This line 'View' is a red error
import android.view.animation.Animation;
Oddly enough, it compiles successfully but won't launch.
EDIT: I tried changing the gradle version which did nothing so I changed it back and now it's launching again... Pulling my hair out on this one :/
EDIT: An older project which hasn't been upgraded doesn't have the same errors. I created a new project with one blank Activity which did have the same errors when I tried to add a few imports.
EDIT: I've deleted my SDK folder completely and done a completely fresh install. but still getting the same errors. Is it possible these classes have been deprecated?
EDIT (Temporary Solution) Changed the gradle settings to target SDK 27 and all of the errors have cleared. Hope I don't need a major code rewrite to move up to 28
Wow, I have used to get the same errors. The problem is that Android Studio recognized the file as a correct file, but overnight, Android Studio might detect errors. Try to re-write your file. If that does not work, think about what you had done before you experienced the error. Sometimes when you change files, it overrides another file, therefore resulting in a error.
When moving to API 28, did you try to convert to androidx?
Other things you can try:
Close Android Studio
Go to c:\users\~yourname~\.gradle and delete the caches folder entirely
Also delete the build folder in your app directory of your project
Start Android Studio
Rebuild your project
Hope this helps, cheers
As recently, I've been looking through Android Templates for Material UI design, as I want to get a feel on how to use the types of pieces in one. But, It's been a struggle. Every one I've done, I got an error when building the module. AndroidManifest.xml Not Found
I've looked every where, and it all doesn't apply to me. I am attempting to import a repository from GitHub to Android Studio, all updates installed. Here were my steps.
Clone the project into a .zip file.
Extract.
Import into Android Studio.
Import Gradle Files.
Configure framework.
All works, but only option to generate signed APK, normal apk, and build module.
Build Module.
Android Manifest isn't found.
Is there something I'm missing? Please let me know, as I am stuck. I've also read I need a local.properties file. I do not have it, so I do not know how to properly add it without messing up.
Thank You.
Refer this, How to import an existing project from github into Android Studio.
Still not convinced?.
Try these, https://github.com/rdrobinson3/WelcomeToL/issues/2 and https://github.com/google/beacon-platform/issues/24
I have two files: library.jar and library-javadoc.jar. How can I import the library into my project in Android studio, such that Android Studio will show me the Javadoc when I mouse over something from the library? To be clear, the problem isn't getting the library into my project because I've already done that. I am struggling to find a way to attach the javadoc. I've been tearing my hair out and I've googled the answer a million times but I can't find anything. I don't understand why this has to be so hard, it was dead easy in eclipse.
I'm making a game where I'm using Google Play Services. I recently switched from eclipse to Android Studio (now running 0.8.14). In android studio I added a "Google Play Services Activity" and had my game class extend that class. I left the services class without modification. The project compiles and runs just fine but the IDE is filled with errors because it "cannot resolve symbol 'common'" and "cannot resolve symbol 'games'"
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.games.Games;
Any ideas on why this is and how to fix it?
I have attempted to reimport my project after deleting all .iml files and the .idea folder without result.
[EDIT]
As per request I'm adding a screenshot of the errors:
[EDIT 2]
I've kept searching for solutions and while I have not found any, I now have a screenshot that may be a bit more helpful.
As you can see, the com.google.android.gms package seems to be missing the common and games package.
I have tried updated gradle, tried using JDK 1.7 instead of 1.8 and attempted syncing with gradle multiple times. I will keep searching for an answer but if you have experienced this before, please feel free to help me and others out.
Add this to your build.gradle
dependencies {
compile 'com.google.android.gms:play-services:5.0.89'
}
Finally I found the real problem. Apparantly, my project was contained in a folder that ended with an exclamation mark. (myProjectName!) This caused Android studio to fail in finding certain imports.
Solution: I renamed my project from myProjectName! to myProjectName and moved the whole project to a new folder without the trailing exclamation mark. This seems to have fixed everything.
I was able to import both ActionBarSherlock and HoloEverywhere into Android Studio but I cannot get my app to compile.
screenshot:
https://docs.google.com/file/d/0BwOn70drOiMfZHZVeXdEVzNXRXc/edit?usp=sharing
For whatever reason my intent's seem to be freaking out and even though the library imports seem to be working fine, I'm also getting the following errors trying to emulate my application:
java: /Users/patdugan/usmc-pro-fitness-abs-he/src/com/patdugan/usmcprofitness/USMCProFitMainActivity.java:16: package org.holoeverywhere.widget does not exist
Anybody have any thoughts?
I just had this issue.
What you need to do is go to File > Project Structure... and click on Modules. Make sure that ActionBarSherlock has the support library under its Dependencies tab. If not, click the plus at the bottom and add a Library (You may have to click New Library... to select the libs folder within the sub-project).
After this is done, change the scope to Provided so that you don't get lib conflicts when compiling your app.
Holoeverywhere doesn't use ActionBarSherlock anymore, it now relies on the ActionBarCompat library.