Helper to fix errors in Android Studio - android

I started to use Android Studio and I am looking for the option to fix errors similar to Eclipse IDE.
For example, in Eclipse, if you have some code that might throw an exception Eclipse shows you an option to surround the code with a try/catch statement, so you don't have to write it manually.
In Android Studio I can't find this option and it's very frustating for me because in Eclipse it was so fast to do this and here I have to do it manually.
Anybody knows how to do this in Android Studio?

for windows
ctrl+alt+t
for Mac
cmd+alt+t
you will find different android studio tips on this link

The command I was looking for is alt + enter and it shows you all the fixes available.

Related

cordova Android Studio unable to run application, no module?

Something happend today with my Android studio program, I can no longer run any applications through it.
I've tried restalling it and everything, but i cannot get an android installation in there. As you can see next to the build icon, it's empty. Any help is greatly appreciated.
and yes, i've set ANDROID_HOME

Android, Xamarin: Unable to start program "The system cannot find the file specified"

this is so annoying.
Yesterday, everything worked fine. I commited my work on my app and went to bed.
Today- nothing works.
I try to debug my program, the app installs on my phone and works but the debugging stops only with: Unable to start program "The system cannot find the file specified".
No matter how ofter I rebuild, set my project as start project, change the target api, or what not. I even updated everything on my computer but it is hopeless.
Please, help me :(
This looks like a promising solution for this issue but somehow it didnt work for me, so I tried to repair my Visual Studio 17 and it worked.
For repairing visual studio you have to download visual studio installer from official microsoft website
If VS is already installed in your machine you'll get a screen with options :- Update, Launch and more.
select more and click repair.
You have to wait until VS finishes repairing. Hope you'll get rid of this annoying issue.
I had a similar issue, and solved it like this:
As Luminous_Dev figured out here:
forums.xamarin.com/discussion/123640/xamlctask-error-on-new-cross-plat-solution
make sure Mono Debugging for Visual Studio is enabled.
Tools > Extensions and Updates> Mono Debugging for Visual Studio
Source: https://forums.xamarin.com/discussion/123611/unable-to-start-debugging-the-system-cannot-find-the-file-specified
make sure Mono Debugging for Visual Studio is enabled.
Tools > Extensions and Updates> Mono Debugging for Visual Studio

Android Studio reports "Could not identify launch activity: Default Activity not found" when building Kotlin projects

I'm trying to build an Android app using Kotlin and Anko. When I select "Run" in Android Studio I get the error:
Could not identify launch activity: Default Activity not found
Error while Launching activity
and the app does not start. I get this error with both the emulator and with a real phone.
To try and narrow down the problem I tried a couple of sample Anko projects, including android-anko-sample, and they all exhibit this same broken behavior.
I have other Android projects I've written in Java, and they run without this problem, which suggests that this is somehow a Kotlin or Anko specific issue. I can even switch back and forth between one of my Java apps and the "android-anko-sample" app linked above, and reproduce the problem with android-anko-sample consistently, while my Java app works correctly every time.
I have looked at other questions involving this error message, and the solutions posted were either not applicable or didn't help.
One thing I have noticed that's weird is that when I open AndroidManifest.xml (of any of these Anko apps) in Android Studio the names of the activities are shown in red, as if they are errors. Here's how the one from android-anko-sample looks:
Note that the app does get installed on the phone/emulator, and I can tap on the icon and run it. It just won't automatically start when I select run from Android Studio, which is pretty inconvenient.
How do I fix this issue?
I'm using:
Android Studio 2.1.2
Ubuntu Linux 16.04
Oracle JDK 1.8.0_131-b11
Code is here:
https://github.com/vsouhrada/android-anko-sample
The complete contents of a few of Android Studio's panes are available in this gist:
https://gist.github.com/xenomachina/e8027b385661038c3f020a543493eebf
This was caused by not having the Kotlin plugin installed in Android Studio.
To fix, go to File → Settings → Plugins → Browse Repositories, find "Kotlin", and install it.

Unable to install Android SDK in Android Studio

So I have been having a lot of problems with Android Studio, and I have just deleted and reinstalled it. I tried to setup Android Studio with the setup wizard but I am not able to download the components. Any idea on whats wrong? Might be something to do with the file path, not sure though.
And here is where it says that an error occurred.
I had a similar problem, try installing without the Android virtual device checked, This worked for me but it was also on a different computer so it might not have been that but it's worth a crack :) Best of luck

Android Studio Cannot launch AVD in emulator. /opt/sdk/tools/emulator: Syntax error: word unexpected (expecting ")")

Not be able to launch emulator in Android Studio.
I have updated my SDK some days ago.
Here is my current SDK details.
My current system is Ubuntu 12.04 LTS with 32 Bit.
I am having Android Studio v1.3.2.
My problem is when I try to launch any AVD from Android Studio I get following error.
I am not able to find out what is the problem ! For your reference I can able to run the Application on real device.
The problem is only related to emulator.
Any help will be appreciated.
Please help me if anyone knows about this i am still facing same problem. Not be able to solve it anyhow.I have tried some of the solutions of SO but it didn't solved for me.
It's because of Linux 32 bit os. I solved this issue replacing old platform tool instead of updated.
following steps you need to perform:
1) download and take old platform tool
2) remove existing platform tool.
3) add old platform tool
4) restart android studio.
now it work fine and you can open emulator without error.
Also if you replace os to 64bit then good for future updates.
Its is because the android emulator doesn't like linux 32 bits. try to create a new Os 64bits.

Categories

Resources