Android Studio cannot resolve Views, not autocompleting - java

I am a beginner android developer, and I am running into this infuriating problem.
When writing in java, the IDE doesn't seem to recognize any of my imports, stating that it 'cannot resolve' any kind of views.
Furthermore, on the activity xml, it says, for all the xml elements, that the 'element is not allowed here'.
Funny thing is, only for certain projects that android studio behaves this way.And all of my projects were created and edited in the same way.
Invalidating cache/restart does not work.

You need to update your SDK if you have setuped sdk path.

Related

Android Studio - package java.awt.image does not exist

I have a problem running my project on Android Studio. I am working on an Android project that has a native Java library inside it. It was running fine all the time. But suddenly when I open Android Studio, I find this error:
There is also an error in the .gradle of the project:
It says that URI is not registered.
When Android Studio is started, I find this message:
It seems that there is something wrong in Java configuration, but I can't find out what is the problem?
It was running fine all the time
Not on Android, it wasn't.
It seems that there is something wrong in Java configuration
No. You are using classes that are not part of the Android SDK.
The java Swing and AWT API are not part of the Android SDK and thus aren't including with it. You must find an Android equivalent image library to use in your app. There are few good ones around just depends on what functionality you need to have available to you in you app. Try searching Picasso and or Volley. Picasso is very popular and well known. it has a lot of feature including networking functionality for loading images from the web. The Volley library isn't an image library but an networking library that contains some predefined classes for loading images over the internet.
So this just happened to me. I'm not 100% on the details of how I got it working again, but its roughly this (on my Mac):
Quit Android Studio
I went to ~/Library/Application%20Support/ and deleted the AndroidStudio3.2 directory
I relaunched Android Studio and I got some warning dialog about plugins not existing.
Chose the button that is something about reinstalling or fixing (or whatever isn't deleting or ignoring)
Another dialog comes up. There are a bunch of plugins that are in red. Deselect all the red ones. Then reselect all those ones that were previously red.
Android Studio asks you something and if you want to restart Android Studio. Pick the thing that includes restarting.
And once Android Studio restarts, chose to rebuild your project, and then it worked.
Good Luck and I hope this works for you too.

Sudden Ide Language Change in Intellij Idea

I downloaded intellij idea from their website and whilst installation out of nowhere I got instructions in a language other than english. The same language was reflected in my netbeans IDE, one of my reasons to switch to Intellij. The language seems to be inscrutable. I tried several trial and errors, but no result.
Since the UI is similar to android studio, and I have android studio, I tried to locate any language settings within android studio but couldn't get any. How did this happen? How can I get rid of this and be back to english?
Any help is widely appreciated..
EDIT :
My Environment variables
Had the exact same problem (with Android studio) while my default windows 10 fonts were set to Nunito instead Segoe UI. After I revereted to Segoe UI everything works nice.

Emulator in Android Studio won't load

Rendering problems. The following classes could not be instantiated:
- android.support.v7.internal.widget.ActionBarOverlayLayout .
Exception Details:
java.lang.ClassNotFoundException:
android.support.v7.appcompat.R$attr
^^^^^------- (The character represented by the '$' is another character I am unable to write. )
This is what shows up instead of my emulator in android studio. I deleted some projects before this happened and may have mistakenly edited a read-only file. I already tried reinstalling Android Studio and the Android SDK from scratch. Same result. Sometimes it will give an error related to utf-8 and give the option to open up the file encoding. It isn't doing that right now. This brings back the emulator but the drag and drop brings up a small window that can be changed on the emulator. And the problem comes back every time I restart Android Studio.
Is there anything I can do to fix this.
Thank you.
Have you tried to change apptheme? I know some rendering problems or error can be temporarliy fixed by doing this.
Try changing your base application theme using below code - in res/values/styles.xml
It seems to have fixed it for some people. It is also a bugg that will be fixed in a later version. Check the link for more info and some workarounds.
http://tools.android.com/knownissues#TOC-Can-t-Render-Layouts-in-Android-Studio-1.2

Android Studio not Generating Boilerplate Java Classes Like MainActivity

Quick Android Studio question.
Lately I've been creating a lot of new projects in Android Studio and picking the templates like "Blank Activity with Fragment" or "Navigation Drawer Activity" and seeing that it's not generating any Java Classes like it should.
All the /res files get created like normal but there is a lack of any java classes so I have to start from absolute scratch.
While starting from scratch isn't the biggest hassle in the world, I'm curious if I'm just an idiot and have missed a flag somewhere.
here's a shot of the file tree when generating a "Navigation Drawer Activity"
Info on my Android Studio/Project:
-Building with Target SDK 21, minSDK 14, build tools 21.0.1
-Android Studio version is 0.8.13
Thanks For reading, let me know if you need any other information.
I managed to solve the problem. You will need to disable plug-ins that are not the need. In my case, I have used them from GWT

Android AndEngine: java.lang.IllegalArgumentException: No EGLConfig found

I'm doing a REALLY simple app, a basic hello world to test AndEngine and I am currently having some problems when running it:
I set my emulator properties as RealMayo suggests in his videos and it should work but I get this error instead
07-23 13:10:23.014: E/AndroidRuntime(1485): java.lang.IllegalArgumentException: No EGLConfig found!
Anyone has encountered the same situation, or may know how to solve it?
I am almost tempted to not us AndEngine at all... as a simple app has been really difficult to run.
NOTE: I have found some posts but they are at least 3 months old and the use of emulators has been fixed not long ago.
Anyways Thank you! :)
make sure your AVD is at least Android version 4.0.3
see this thread http://www.andengine.org/forums/gles2/api-level-t8230.html
just to add a small addition to the answer above (answer #1): make sure along creating an AVD with API level 15 (Android 4.0.3), that imported AndEngine library's project target is also built with Android 4.0.3. To validate: right click on AndEngine library in eclipse project, choose "properties", in the left pane of opened window click on "Android" label; in right pane verify that "Android 4.0.3" checkbox is checked. If "Android 4.0.3" option is not listed there, just import it with Android SDK Manager.
The comment from Ravikumar11 about GPU helped me get this resolved.
Additionally, I had to:
Update the SDK with all options for my current API (17) and the general tools (binary downloads that are not API-specific)
As eclipse suggests after SDK update, run Check for Updates in eclipse and a bunch of stuff gets loaded subsequently
From there, I was able to run my AndEngine app in the emulator

Categories