Error on running new project in Android studio - android

I just installed Android Studio 0.3. After creating a new Project (I've not changed the code) I get error on R.layout.activity_main and every line that uses R class saying
Cannot resolve symbol R
.
Also on the bottom of the screen in warning/console segment I get this error:
Gradle: Execution failed for task ":First_Test:mergeDebugResources".
/home/alireza/AndroidStudioProjects/First_TestProject/First_Test/src/main/res/drawable-xhdpi/ic_launcher.png:
Error: Cannot run program
"/home/alireza/IDEs/android-studio/sdk/build-tools/android-4.4/aapt":
error=2, No such file or directory
It's my first time I use Android studio and I'm new to Linux (mint Olivia) so I would be very greatful if you help me this issue

The R resolution error is due to not having built the class files yet. It will go away after you build once.
The second error is likely due to your Android SDK Tools not being updated. Go to your SDK Manager (within Android, Tools > Android > SDK Manager) and update "Android SDK Build-tools". Restart Android Studio and try again.

This is funny but solution was restarting computer! After reboot android studio worked perfectly and I was able to run "Hello world!" app on my device.

If you are having this issue on a 64bit version of linux (ubuntu/mint) rebooting does not help.
This answer however worked for me on Linux mint 16:
https://stackoverflow.com/a/19623295/183091

This error has something to do with the amount of free RAM in your system.
Freeing some RAM (closing other programs) can solve this problem.

Related

Android Studio error "installation failed since the device possibly has stale dexed jars"

I formated my computer
and installed Android Studio
Before that my app was working fine,
after formating and installing Android Studio
I keep getting this error
"installation failed since the device possibly has stale dexed jars"
and in every emulator I open I get "Storage Space running out!" although I just installed Android Studio and my first time to run my app, not sure how got full?
and not sure if this is the reason for dexed jars issue too
Any advise?
Thanks
This worked for me:
In Android Studio this can be done by clicking on Build > Clean Project.
Disable the instant run.
This is a known issue of instant run.

Android Studio Blank Activity Compilation Fails

I have been coding for a few years now and decided it was time to sink my teeth into android development. So I downloaded the latest version of Android Studio and installed all the relevant components with the installer.
However when i try to create a new project, using the blank activity, without even changing a single line of code, or editing the project in any way, the compile fails with the below error:
android execution failed for task :app:packageDebug
> Implementing Class
I have no idea of to fix this, any help would be greatly appreciated.
Thanks
I have been having the same error message. This is what I have found out:
I have a Mac Book Air with a Custom OS Image installed (from work) and on this computer I see the same error message above even from a fresh install (custom image) and fresh install of JavaRE and JDK as per the Android Studio System Requirements. Also a fresh install of Android Studio using a Blank activity with no additional lines of code.
However, I reinstalled OS X 10.10 from scratch, straight from the App store, with no OS customizations, installed the same JavaRE, JDK and Android Studio and the Error message did not appear.
I have been scratching my head over this error for a while now and this is the only solution that I have found. I'll keep digging and report back if I find a better solution.

Failure to install APK [INSTALL_FAILED_DEXOPT] Android Studio

I have tried literally everything to try and rectify this error when trying to deploy an app to an actual android device for debugging but have been unable to solve the matter. Everytime I try to launch I get a failed [INSTALL_FAILED_DEXOPT] error and when checking the logcat it is always because there is no classes.dex in my debug apk.
If I run gradlew.bat clean assembleDebug, there is no difference in the apk size so I'm assuming there is a build error in android studio. I am using android studio beta 0.86 and have tried it on 0.89 with the same result. I have tried build tools for 19.1 to 21 with no result. I have also tried different devices and created a new project (that has never been installed on my devices) and android studio seems to think it needs to be uninstalled first when attempting to deploy.
I have tried switching my device to ART, uninstalling and reinstalling android studio, redownloading the sdk and restarting my computer. NOTHING and I mean NOTHING has worked. I think the problem started after I downloaded the lollipop apis but am not sure. I have tried uninstalling all apps with my package signature on my device but NOTHING works! Not even Project -> Clean Project -> Rebuild
This is extremely frustrating as I cannot debug my apps anymore :/ has anyone had any experience with this error or ways to rectify it?
So turns out that the issue was mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.
UPDATE:
I ran into the problem again after I tried to update my SDK and its tools. Turns out that when you try to do this, the SDK locks the tools folder and then you get an error saying some file couldn't be overridden. When this happened to me, all the build tools were deleted so there were errors in the .dex file created when debuggin my app.
We are using android 2.2 (really old i know) and couldn't find a fix for this error. Eventually we found this bug https://android-review.googlesource.com/#/c/30900/. The only solution for us was to remove some libraries...
I kept having the same problem - manually building worked fine, but Android Studio would not build a proper APK.
The problem was that I started the project on Android Studio and Android Gradle plugin version 2.0-beta2. After updating the Gradle plugin to 2.0-beta6 through a simple build.gradle change, the builds stopped working.
Turns out that, although I installed a beta version of Android Studio, the update checker only checked the stable channel. After setting the updater to check the canary channel as well, I was able to upgrade Android Studio to version 2.0-beta6 and builds continued to work normally.
You can change the update preference in Android Studio settings under Appearance and Behavior -> System Settings -> Updates.
I encountered this error when storage of the device is full. Try to open some space.
Try run these commands
adb reconnect
adb reconnect device

Issue setting up Android SDK - Failed to Start Emulator

I'm new to Android Development and I am attempting, and apparently failing, to set up the Android SDK with Eclipse. I thought I had everything working, but when I go to start the emulator I had set up I get the error message:
Starting emulator for AVD 'MyDevice'
Failed to start emulator: Cannot run program "/home/danny/android-sdk-linux//tools/emulator": error=2, No such file or directory
Note: I tried chmod-ing the directory containing the SDK as a search told me that would help, but it didn't work.
I'm on Ubuntu 13.10 and I'm using Eclipse. I also had another problem with the creation of a new project, but I'll wait and ask that in a new post in case the solution to this problem doesn't also solve that.
its your path as you have //in it..
directions on how to modify profile is at here:
install on Ubuntu

Cannot create new Android application project or access Android preferences using Eclipse Kepler

I am using Ubuntu 13.04 and Eclipse Keplar.When I try to create a new Android application project the following message is displayed:
The selected wizard could not be started.
Plug-in com.android.ide.eclipse.adt was unable to load class com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.
An error occurred while automatically activating bundle com.android.ide.eclipse.adt (241).
I cannot access the Window->Preferences->Android page,when I try the following message is displayed:
Unable to create the selected preference page.
An error occured while automatically activating bundle.com.android.ide.eclipse.adt.
No updates for the ADT plugin or the Android SDK were found.
What should I do to restore the ADT plugin to good working order?
Thanking You
Ran into this same problem today running a Windows 7 machine. It has been a while since this question has been asked, but having an answer here might prove useful since this thread is ranking highly on Google for the error message:
I found that cleaning all projects in Eclipse and restarting it once it was finished solved the issue and I was able to successfully create a new Android project afterwards.
Eclipse menu: Project >> Clean
Similar problem/answer found on stackoverflow.
From console, run eclipse -clean (you'll need to make sure eclipse binary is in your PATH, or use full path to the binary).

Categories

Resources