4

I'm very close to giving up with Android development. I don't currently have an Android phone so I'm trying to use emulators. In Eclipse, after fixing 500000 bugs/errors I finally managed to get an emulator to launch - but it kept getting stuck on the Android loading screen (even after like 45 mins) so somebody recommended me to use Android Studio.

I downloaded this on my PC, and when I tried to run a blank activity I got this error: enter image description here

When I tried to actually play around with the activity, I got a rendering error: enter image description here

I saw some stuff online that said to use a downgraded Android version for the error to go away - however, I only have 2 versions as you can see and none of them are working.

I tried downloading/installing Android Studio on my laptop too and got the exact same problems. What is going on? I have spent 2 days trying to run a blank activity now and am really on the verge of just giving up. Any ideas?

EDIT: Trying out Jorge Casariego's suggestion but cannot find Open Modules when I right click

enter image description here

eyes enberg
  • 556
  • 1
  • 8
  • 30
  • Do you have the JDK 7 installed on your machines? If I record correctly, JDK 8 doesn't work right now with Studio... – Mauker Jun 02 '15 at 14:31
  • If I type java -version in my command prompt it tells me that my current version is 1.7 – eyes enberg Jun 02 '15 at 14:37

4 Answers4

2

To downgrade your SDK, you need to download a different SDK version. To do this, you need to run the SDK Manager which is the 4th image from the right: the 4th image from the right.

This will allow you to download different versions of Android, allowing you to get API 19/20/21, which should fix your issue.

I get this rendering problem all the time and I've been developing for almost 2 years now, with over 10 months on android studio. These rendering problems are only for the activity preview, which usually isn't very helpful at all anyway. If you don't have an Android device, my best suggestion would be to download the GenyMotion emulator. It is 1000x better than the built in emulator, and even has a plugin for android studio that allows you to run it from within the IDE. If you need to check how a layout works, I would recommend just running the app in the emulator, as you will get a much better idea of how things look anyway, rather than trying to approximate it with the layout previewer.

Edited 6/10/18: The packaged emulator has been updated extensively and now performs much better. For that reason, I've removed the link to the 3rd party tool. I realize my intention at the time was to be helpful, but having a link to a 3rd party tool in a stackoverflow question seems inappropriate, especially given the reason for highlighting it is outdated.

Elli White
  • 1,440
  • 1
  • 12
  • 21
  • Ah I've had bad luck in that everything I install or download just doesn't work as it should and comes with a ton of errors and bugs. Thanks for this, I will try the emulator as a last resort if there aren't any other suggestions that fix the problem. I don't know why I'm struggling so much to run a blank activity - Android seems really messed up. edit: just saw your edit, I'll give that a go! – eyes enberg Jun 02 '15 at 14:45
  • Unfortunately there are still some growing pains with Android still, especially with getting the IDE set up. Once you get this all running though, everything else is a breeze. – Elli White Jun 02 '15 at 14:48
  • I hope so. Cannot resolve symbol "R" - I'm getting this error out of nowhere (haven't touched anything) and it doesn't go even after building/cleaning. Why do these things happen lol – eyes enberg Jun 02 '15 at 15:15
  • To be honest, it seems like you made some errors in installing Android Studio in the first place. I would completely clean out any trace of Android Studio and reinstall from scratch. Cannot resolve symbol R is an error occurs when the IDE cannot build your R file, which is a mapping of all your resources by their id's. It is a generated file, and when there are internal errors in your IDE, it will struggle to build it. – Elli White Jun 02 '15 at 15:17
2

Looks like it happens because you are updated Android build tools to "24.0.0 rc1" but not update gradle build plugin to 1.3.0-beta1 version.

Make sure that you have in yourProjectFolder/build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0-beta1' // or 1.2.3
}

And in yourProjectFolder/mainModuleName/build.gradle you have

android {
    ...
    buildToolsVersion "24.0.0 rc1" // or 23.0.1
    ...
}

or as a variant use last stable versions of build tools

Stepango
  • 4,721
  • 3
  • 31
  • 44
  • @eyesenberg its really simple. In your project root folder you'll have build.gradle file just make sure that you have "classpath 'com.android.tools.build:gradle:1.3.0-beta1'" line there – Stepango Jun 02 '15 at 15:17
1

To resolve this issue follow the following steps :

  1. Go to your app folder under Navigation section.
  2. Right Click -> Open Module Settings
  3. Set Compile with SDK Version as API 22 or below (Lollipop)
  4. Set Build version as 21.1.2
  5. Clean + Build your Project

to use the new M preview, you'll need to also use Android Studio 1.3 Preview (from the canary channel).

Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
  • Hello, thanks for the response - check my edit please. – eyes enberg Jun 02 '15 at 15:06
  • @eyesenberg is belowe "Compare With" – Jorge Casariego Jun 02 '15 at 15:19
  • Lol not sure how I missed that. For build version I only have 23.0.0 rc1 and 22.0.1, I tried 22.0.1 and still the same problem :( The following classes could not be instantiated: - android.support.v7.internal.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache) – eyes enberg Jun 02 '15 at 15:32
  • which version of Android Studio are you using? – Jorge Casariego Jun 02 '15 at 15:39
  • Nvm its working now, thanks. I get this error when I try to run the app but I'll deal with it another time: emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX kernel module is not installed! – eyes enberg Jun 02 '15 at 16:08
  • @eyesenberg Perfect!! Now you need to do this http://stackoverflow.com/a/26380900/2091181 – Jorge Casariego Jun 02 '15 at 16:12
  • Nice, I got it working. Thanks a lot for you time, I feel like this is a big accomplishment :D – eyes enberg Jun 02 '15 at 22:17
0

I have this problem too. Because I named my App the wrong thing. It has a "-" character in the app name. Ex: Web-ViewDemo. It causes a wrong location, so android studio can't do anything totally right 100%.

In short, try to rename your app!

MrHug
  • 1,315
  • 10
  • 27