Not Resolving/Importing Any Class Android Studio - android

Okay its weird error though, but I will explain it, actually I did remove "emulator" folder from my android SDK folder because it's causing android studio to slows down on ita knees, and when I did it, it throws a Gradle related error like "Can not read from some file", well for that i did reinstall Gradle 4.1 and error gone, but the weirdest problem occurred, now i can not import any class except appcompatactivity and constraint layout which I implemented in build.gradle , for those who wonder what I have messed up with the Android SDK folder, I want to tell you guys I just downloaded everything from scratch except having JDK 1.8.0_171. I mean I can not even import core java classes or anything, studio is pointing out for "please specify android SDK" or something, but hey I have already fresh SDK, what will be the issue, help me guys, and I swear I will never mess with SDK, am running out of time, already wasted too much time with this, Thank You !😊

Okay so finally i deleted C:/users/username/.AndroidStudio3 folder with all files in it! Works like charm ! An stupid solution for a stupid problem, btw problem solved ! Thanks everyone !!😊😊

Close the current project and go to project location directory and delete
.idea folder
You can open your project again. This worked for me and problem comes most often when you are working with VCS. And this problem is not associated with android component classes but also to the libraries, both shows the same error.

You need specify the SDK in Modules section in Project Settings.
Right Click your Project Name in Android Studio and Select Settings..
or
Perform these three steps
Open gradle.buld in your app module
Change minSdkVersion and sync gradle
Revert back your minSdkVersion and sync gradle again

Related

Gradle on adroid studio not working properly

Hello there I seriously need a help, I am a python programmer who just have started learning flutter, I have been sitting on one single error for 12 hours now.
I have tried every possible solution on the internet. I have re-installed android studio too, tried to fix xml files too. I am attaching the error below and a screenshot of my build.gradle too, please ask for more if need.
I also get this issue and in my case I found two solutions. First, rebuild the project or you can also try clean project. Second if your project is not big, you creat another fresh project and copy all codes from previous project to this new one and third but not in the list, go to settings and search gradle and then select the latest version of gradle or download it after finishing it restart the android studio with "run as administrator ". Hope it will works.

Android Studio 3.0 xml-layout file's preview not showing

When I open layout file in my new Android-Studio file and press preview tab it'll show a message Waiting for build to finish... for infinite time.
Has anyone faced the same issue or any solution?
Cleaning and rebuilding my project solved the issue.
try different theme (may be from Appcompat) and API level from top
OR
If you have made some changes in the layout just undo it.
delete .idea and .gradle folder from root of the project
close android studio , restart it
click on gradle icon from right sidebar and click sync icon to refresh project.
now rebuild the project and it should work.
After a lot searching and I tried all solution which people give here, but any of them didn't solve my problem, I guess this problem is from studio's developers, and they may fix it in next patch.
so I simply re-installed my android studio and it's solved.
Try Clean and rebuild project.and Also try Invalidate caches/Restart.And this issue is also facing because of Low Ram in laptops.
After upgrading to Android Studio version 3.1, in the Project Structure dialog the build tools version was empty. Selecting a build tools version solved the problem for me.
Hope it helps for someone facing the same issue.
See my response on similar question posted:
Android studio error java.lang.IllegalArgumentException: Resource name cannot be empty
This error can occur when you update to Android Studio 3.0. It doesn't affect your ability to build a project, but the error does not allow you to visually see your xml layout files. You will also get the error when committing files to GIT, but you can still commit and push.
What I found in one of my projects is that a file was added to the "menu" folder automatically upon Android Studio upgrade, and the file had no name. It was named simply ".xml". All you need to do is delete the file and clean your project, allowing a new build of the project. That should take care of the issue.
For me I had this problem with one file, so I simply created a new one with the same code.
Simply make a build from within AS - not the command line. I get this all the time because I'm mostly using the command line. It's been like this since early versions of AS so I recon it's not high on there list of issues.
Lately (3.2) there is a lot of new internal crashes and what not - not stable at all 🤐

Showing Error in all projects: ADT Bundle

I am using ADT bundle for my Android Application Development
1) From last two days whenever I open my ADT bundle its showing error in all the projects (But I have no errors in my projects and I am sure about it). I tried to clean all the projects but no use... Sometime a restarting eclipse will solve this problem but after few days I am getting this same errors again.
2) Also In my Android SDK Manager some packages like Google API and system images in extras were broken, I don't know what to do.
I tried to clean my projects and to update the SDK manager but nothing solved my problem. Kindly tell a better solution to solve this problem. And tell me why these kind of errors are happening.
Thanks a lot in advance.
But for this kind of problems need more clarifications. Here is my few tips to resolve it. It may or may not work! But better give a try.
In each class or java file which place exactly it showing the error? For example for few it will sow error in R. file and the error will be R cannot be resolved into type. If you are getting this error try to import you package R. file (Like import com.example.R) will resolve issue. If you couldn't import then try to check the package name in manifest file and other layout files. Try to resolve all errors one by one in res folder then clean will help it.
Next check whether Eclipse issue or ADT issue. You said few things are broken in ADT i don't know what exactly it means but try to uninstall and re-install them again.
Try to update eclipse. You can do it by Help->Check for updates
If nothing helps follow the error which are displayed in Problems tab which present near console tab. Otherwise open it here Windows->Show View -> Problems.
Hope anyone will help you if not please follow the errors and edit your question with error. So you might get better answers!
I had the same trouble.
I completely remove Eclipse and SDK bundle; then, i re-install everything.
This worked for me.
Do check this, Lint Error Checking will slow your ADT also seems to be occur error like what you got in a often situation..
so Disable lint from Windows-> Preferences -> Android-> Lint Error Checking, Under
Uncheck the two option in right hand side.
Be aware of what all your projects have JDK compliance.. set common JDK level.. mostly 1.6 based on need change to 1.7 for all projects..
set JDk compliance level in properties of your project -> java compiler and select in right hand side..
Always Check when importing any projects after import if its came up with a compatibility library or external library to be added like appcompat_v7
Check in properties of project under android tab in library section if there is any missing files..
From all the above suggestions are not fulfilled your problem, then go ahead with a new fresh latest ADT Bundle with a fresh download of platforms of SDK.. it will solve most of the ADT problems..
Finally the problem solved
This problem occurred due to missing target SDK in project properties and because of the broken files in SDK manager.
What I did is:
1) I deleted all the broken images and Google api packages from the SDK manager and I re installed all the packages again,
2) Then I selected android 4.2 as the Android Build Target in the project properties.
Thanks all for the time and help.

Surprise behavior of eclipse for C files while using JNI, Why so?

I am developing an Android App in which I use lot of JNI Code.. Recently (from last 2-3 days I am really annoyed by surprise behavior of eclipse) it shows me vague errors as soon as I open my .c file... However errors disappear if I close and reopen the project. See the secreen shot attached. Is it because I just update my eclipse installation (just update of eclipse plugins, I am still on my old Indigo)...
Is it an eclibse bug or something wrong with my setup ?
Solved ????
I tried everything but noting could change the behavior of eclipse.. By this time I knew that I have certainly messed with the project Settings by mistake, since eclipse was behaving well in other projects of same workspace. So I recreated the project manually and finally that solved myproblem...Though the Question is still open for valuable answers I think soon I will get some good answers..
UPDATE
Even eclipse 4.2 release also has this problem.. #frustrating
I found that deleting the project and than reimporting the project to workspace solves the problem. However I also came to knew that deleting .cproject file from the project tree can also fix this problem. Fixing the NDK path (Window -> Preferences -> Android-> NDK) in Eclipse preferences may also solve the problem.
Solution 2 Which may work in few cases...
Right click on the project.
Select Android Tools -> Fix Project Properties

Android Eclipse Error "Android Packaging Problem"

I am getting an error in my Problems tab for my Android Project in Eclipse. The error is "Android Packaging Problem" with an Unknown location.
Unknown Error NullPointerException
I cannot determine what this problem is. My project was working a few hours ago. The only change I made was to add a public interface ITrackDao to my project and implement it. There are no errors associated with this.
I am not even sure where to begin to look. I cannot launch the application. Can someone give me an idea on what area I can look into?
Thanks
Peter
I was confronted with this problem too, and I solve it by clicking Menu->Project->Clean. The error goes away after cleaning the project.
I had a similar error - but instead of a NullPointerException it was an InvalidoperationException from somewhere in Eclipse.
A Project > Clean solved that one too.
Cleaning the project was not enough for me. I had to first remove a <classpathentry/> that specified the interface from the .classpath file and a <linkedResources>'s <link> to the same interface in the .project file before cleaning the project would remove the error.
I had the same problem. I tried the clean up option but for some reason it still did not work. I copied my project and pasted it as a new project and that cleared it up for me.
I had this same error in an imported project and cleaning was not helpful, however by deleting the library references in the .project and .classpath eclipse files, and then relinking things and cleaning, I was able to get things building again.
First I should recommend that you start using subversion or other versioning on your apps, that way you can pinpoint every change between each iteration. If your project was in subversion you could compare with previous and then pinpoint what changed.
With that said, I would also check through any recently changed layout XML, make a change and hit save and make sure you don't get errors. I've experienced strange null pointer/errors in Eclipse at times when my layout was fine, and by making a change and saving, the errors go away.
I ran into the same problem coz of my blackberry sdk installation. I think it messed up my eclipse 3.6.2 install . I just reinstalled eclipse and it all worked like a charm
I worked with a SVN project and one installation have eclipse Galileo. The other have updated to Helios.
In Helios I found this problem and clean is no solution.
After Galileo reinstall (all installations equals now), I deleted workspace and a new checkout resolved the problem.
I had the same problem. I tried the clean up option but for some reason it still did not work. I solved this problem using this step
Project name ->Android tool ->Add support Library

Categories

Resources