Android Studio not recognizing classes after power failure - android

A co-worker is having this problem for second time with Android Studio (first time he just got tired and reinstalled Windows)
After a power failure while using Android Studio on Windows 7, it couldn't resolve symbols for all android classes anymore. SDK and JDK seem well configured and we even downgraded to JDK 7u75 in order to discard that he originally installed JDK 8.
SDK Manager works and shows all needed APIs installed.
When creating a new project it comes with the same problem and reinstalling Android Studio doesn't help either. When exporting the project and testing it in another computer it works correctly.
What could it be?

Android Studio caches a lot of details that won't be fixed by simply running a clean/rebuild on your code.
When facing any issues like this the first thing to do is often go to File -> Invalidate Cache/Restart and perform a full cache drop and restart.

Related

Android Studio select SDK error on trying to run project

I am using Android Studio 3.1 on Ubuntu 18.04 LTS. I'm currently working on a project with target API 28. I've downloaded the SDK with API level 28 during installation but sometimes when I try to run my project on my device, a popup dialogue prompts me to select the SDK. This does not happen every time but happens sometimes even if I've run the project before and made no change to the SDK path. I don't know what triggers this. I've seen similar questions on StackOverflow, but none of the solutions work for me. Here's what I have done so far:
Synced my project
Invalidated cache and restart
closed my project and opened it again
Uninstalled my SDK and downloaded it again
Switched back to an older version of SDK and then back again
But none of this works and the only workaround I found was to open another project that I downloaded from Github (with API 26), build it and then go back to my current project. This solves it temporarily. A few of my friends are working on the same project on different machines (Windows, Mac) and they have this problem, too.
Is this a bug with AS or is there a permanent solution?
File->Settings->Android SDk.
If already was there in your system set the path to that otherwise download the SDK from SDK tools by selecting specific name.
I've found this workaround. It is not perfect, but it works. Hope this this will be helpful for someone else.
Move your project folder to another location and then open it. It resolves the problem.

Android Studio 3.0 - Cannot load any Android projects

I updated to the latest Android Studio 3.0 version, and no matter what I do I cannot get a project to be properly recognized by Android Studio.
For one, Android Studio projects typically have the Android Studio icon instead of the typical folder icon in the file system, when browsing for a new project to open.
For two, this is what my project structure looks like - no modules, and I also cannot select "android" view instead of "project".
For three, I cannot run, build, or clean the project at all.
Sometimes when I open a project I get this error:
And sometimes that error doesn't show up at all.
Has anyone encountered this? I'm tried uninstalling Android Studio and re-installing it, installing the new 3.1 Canary 3 version, the stable version, nothing works. I've deleted and recloned every repository - I've tried many, big and small, and none work. I can compile fine from the command line though.
Many of these repos are used by other people currently using Android 3.0 stable and 3.0 Canary 3, and I'm the only one having issues, so I'm very certain it's not a repository issue. And if it is, I probably am not allowed to make whatever changes would be needed to fix this issue.

AVD - No prgramming changes applied

I recently updated my version of eclipse from 3.6 to 3.7
(Using Mac OS X 10.6.8 & Eclipse 3.7). I did this to install EGit. Since, then I have noticed that none of the changes to my App are being reflected in my AVD's.
When setting up EGit I realized that it had moved my working location to another location on my system. I figured this might be the issue, so I removed my EGit repository and restored my App from a backup. The problem continue leading me to believe the problem likely lies (I could be wrong) with the upgrade to Eclipse 3.7.
I have tried many other things, but none seem to work. So far I have..
Uninstalled my App from the AVD, and then re-ran application. This made no difference.
I have tried creating a new fresh AVD. Same deal here, same un-change version of app is applied.
I tried stop and restarting the adb.
I have tried to 'Clean up' the Project.
All attempts so far have failed.
Has anyone else out there seen this problem or have any suggestions?
I think the next thing I might try is updating my Android plug-ins. If this fails I Afraid my next option is to uninstall Eclipse completely and start from scratch.
Any suggestions would be great.
I solved the problem.
My guess of updating the Android SDK was correct.
In Elipse I went to Window -> Android SDK Manager.
I installed the available updates:
Android SDK Tools 22.0.1,
Android SDK Platform-Tools 17,
Android SDK Build Tools 17. After the install restarted Eclipse and then boom! My AVD was back and showing my newest changes. Hope this helps some one.

Eclipse/Android can't generate R files for any project

I am a new Android developer (4 weeks into porting my iPhone app to Android). I have 8 projects (the app, and 6 small UI experiments, and a vanilla Hello World project that I just created with Eclipse). All fail to compile, and the issue is that every reference to the generated file R is flagged as "R cannot be resolved to a variable".
Up until yesterday afternoon -- every project compiled and ran (albeit very slowly) in the Android emulator. I've changed something, and since yesterday, all projects fail to compile, all in the exact same manner "R cannot be resolved to a variable". I every case, the generated files are missing. I believe they disappeared as I tried to clean and rebuild each project in the course of debugging this problem.
Two things that I know changed when this problem started, but that I can't say caused the problem, were: 1) shifting to debugging on a real Android device (a Samsung Galaxy Tab 2, which worked like a champ after struggling with the slow emulators), and 2) allowing Android (and perhaps Eclipse) to update themselves from the web.
I've spent many hours trying other user's suggestions and none have helped. Most suggestions refer to file naming issues, xml syntax errors, but I haven't changed these files and filenames since compilation was working. I have tried:
cleaning and rebuilding the projects
checking for subsequent updates to the Android SDK (and there were 2 subsequent ones)
Eclipse->File->Android Tools->Fix Project Properties
making small source changes to force rebuilding
rebooting Eclipse, as well as the Mac host, adb, the emulator, the Android SDK Manager
deleting a project, restarting Eclipse, and adding the project back in (bad idea - this fails with an error "Failed to load properties file for project 'ListViewFragmentTest'"
creating a brand new Android App project, which has worked many times before, but now fails
There's something going systematically wrong, and while I won't claim all these projects are bug-free, they did run up until 6pm yesterday, and then all stopped compiling thereafter.
I wonder if anyone has other suggestions, before I embarking with a complete reinstall of the development environment?
My environment is:
Macbook Pro (OS X 10.7.5, 8GB RAM, 2.53GHx Core i5)
Eclipse (Indigo Service Release 2, Build: 20120216-1857) (too old?)
Android SDK Manager Rev 22
Android SDK Tools (22), Platform Tools (17), Build Tools (17)
API's 11-17, all up-to-date
Seems like lots of people experience trouble with missing generated files (R), and I have had trouble when I've had layout XML errors as well, but that doesn't seem to be causing this problem. Thanks in advance for your help!
I am not sure but you are facing issue of R.java file is not getting generated after updated with ADT rev 22.
If this is the case then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.
Check in the Java build path library, whether "src" check box is checked or not.
If you are using any additional Libraries then make sure libs/android-support-v4.jar is same for project as well as the Libraries.
Thanks everyone. None of these suggestions resolved my problem. And while I'm curious as to why it happened, I was more impatient with not making any progress. I've reloaded Eclipse and the Android tools (this time with the bundled version from developer.android.com), and everything is working smoothly again.

Is it time to upgrare to eclipse to ver 3.6.xxx

About 2 months ago I was setting up an Android development environment, and noticed a warning on the Android SDK page that stated "There are known issues with the ADT plugin running with Eclipse 3.6. Please stay on 3.5 until further notice." - so
I posted a question here about this and from the responses decided, to install Eclipse ver 3.5
I never saw a notice that it was safe to upgrade, but...
- The warning is now missing from the Android SDK page
- I thought I read (maybe I'm wrong, because I can't find it now) a comment that some of the Android tutorials were now assuming Eclipse ver 3.6.1
Can I assume it is now safe to upgrade to Android 3.6.1 ?
The Eclipse IDE for Java Developers download page still seems to be at 3.6.0 ?
Comments Welcome
I believe it is fine, i upgraded my desktop environment to 3.6.1 and everything seems to be running fine.
Confirmed: Here is the link to the requirements page. It now says anything greater than 3.4 will work.
Eclipse 3.4 (Ganymede) or greater
Eclipse Link Requirements
I upgraded to the latest 3.6 and it was OK except that the content assist for the Android classes was very slow, i.e you would type 'textView.' (where textView is a TextView) and wait for ages for all the available methods to be shown.
This issue is a known bug reported at
Code Assist still Slow
Down near the bottom of this thread, someone identified a fix:
*https://bugs.eclipse.org/bugs/show_bug.cgi?id=329288 contains patch
that fixes this issue.
Unfortunately patch is applied only in 3.7 branch.
I have patched org.eclipse.jdt.core from Helios 3.6.1 with the patch
attached in this bug and create a patched plugin.
You can replace your /plugins/
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar plugin with one from
http://adt-addons.googlecode.com/svn/patches/org.eclipse.jdt.core_3.6...
and restart Eclipse. Content Assists will be much better. Just try it.
Don't forget backup your original plugins.
Peco*
I applied this patch and everything works fine now.
I always used Eclipse Helios 3.6.1 for my android programming and I never had any problems, I don't know what the problems were but I didn't find any. Sometimes my R.java doesn't seem to connect with my other classes but I solve that by either restarting my Eclipse of just clean my project, most of the times clean project works perfectly.
The ADT plugin also works fine. It upgrades correctly and I can see all my versions when I create a new project
I did see people having project to even install the google ADT plugin when looking for new software but I didn't come accross that problem. It just installed the first time. with the new update however it seems that my adb.exe doesn't seem to be in my tools folder and Eclipse looks there, so I just copied it from my platform-tools to my tools folder and got it working.
When I tried to update the 2.3 sdk to 2.3.1 in Eclipse 3.6.1, I had to clean all my projects as well as start Eclipse several times before everything could be installed successfully. Other than that, I've had no problems at all.

Categories

Resources