How to run kotlin app from android studio? - android

I cloned this repo onto my laptop: https://github.com/mozilla-mobile/focus-android
I then opened Android Studio and imported project. (imported the focus-android folder). But the run button right now is grayed out. I tried to edit configurations and launch the MainAcitvity.kt. Here were my configuration settings:
https://preview.redd.it/mdyg1vcvcxi41.png?width=1073&format=png&auto=webp&s=bdcf5f6f51d59c9b107b459a0e2fc76dd6db059f
but I cannot select a module and it says Error: Module not specified when I try to run it. How exactly do I launch an activity / run firefox focus through an emulator given the github repo?
Thanks in advance!

Here is a tuto to create a virtual device: https://developer.android.com/studio/run/managing-avds
PS: I just run the project to see, I did File > New > Import Project and it was working, here is a screen of what you should have https://i.stack.imgur.com/Nv5NN.png

Related

Android Studio can't find runner

I cloned a project from git and built it in android studio without any problems but I don't have (Run app) in android studio and also when I run run-android I get this error:
Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`
but I can run my emulator from AVD manager!
I did every solutions that I found with search but they didn't work for me
For me, the reason was one of the following:
Gradle sync was in progress
Gradle sync had failed
For the second case, go to your top-level or app build file and click Try again or Sync button on the notification shown at the top of the file.
You could also just try to sync the IDE with Gradle with either of these buttons:
I faced a similar error. I was trying to import a built apk to profile it and ran into the scenario where the run button was grayed out.
Ultimately what worked. I went to File > Manage IDE Settings > Restore default settings.. and redid the android studio setup.
Note: Doing this will RESET the entire Android Studio and redownload everything.
1- Give the SDK path (to find the emulator path), Usually in User\YourUsername\AppData (is hidden by default)\Local\Android\Sdk. in File->Project structure, SDK location. Also the Java\Jdk path for (JDKs) and the path "...java\util\concurrent" exist
Do not reset the IDE Settings (because you need to reinstall a lot of things and it will not solve)
2 possibility - from File->Setting->Tools->Emulator to check the Launch in a tool window
3 possibility -

unable to run a cloned repo in android studio

I cloned a Beacon Library https://github.com/Codefy/onebeacon-android from github, it has some samples that i want to run, but as i cloned the repo my debug buttons become disabled.
The README file says that sample projects are ready to build, it would be really helpful if someone would explain how to run it.
i repeat that i want to run base service module on my deivce.
Thanks in advance.
Solution
It turned out that the right way to do was to :
(1) Open Android Studio, then File-> New -> import project -> select sample directory.
(2)Then fix the gradle issues.
(3) Select the specific module you want to run.
Create a new folder and open it using the terminal. Clone the GitHub repo using the terminal (git clone https://github.com/xxxxxxxxxx/xxxx.git). Then open it using the Android studio and you will be able to run it. I don't know how, but it worked for me.
Just Restart Your android Studio. It works for me.

How to run a project that is inside some subfolders on android studio

Please see the attached image for the project structure. Currently its the run button is greyed out. I know that I can from files open only the folder from where the android studio project starts but then version control will not work.
Right click on the MainActivity (or what ever name you use for your launching activity) and say Run. It will automatically setup the run configuration for you in Android Studio.

Android studio unable to build downloaded project

I'm very new to Android, I downloaded sample project from Developer.android.com,
and when I open in Android studio,I couldn't see clean or Build option.
please guide how to build this project.
Is there any good sample code for Navigation Drawer with activities and Images?
Thanks.
As Kristy Welsh pointed you need to import the project.
Video how to import.
Project with Navigation Drawer.
It looks to me like you have a project that was created in eclipse. Try importing that project into Android Studio and it will do the build for you.
There should be a big green play-symbol you can click. It then opens a pop-up where you can choose to either run it on an emulated version or load it onto a connected android device (provided you have the drivers and the phone allows this direct installation). An alternative would be to build an .apk and put it into your phone's file system to then install it via the phone. This takes way more time but is the way to distribute your app to friends without using the play store.
if there is no error after downloading ,try to sync the project
You have to add a Configuration at Run>Run Configuration>Green Plus>Android Applicatio. now select your Launch Activity and your Module

How to run an Android Studio project directly from the Finder?

How to open an Android Studio project from the Finder? I see the below list of files. Is it possible to double-click one of them to get it opened by Android Studio?
Sorry, but there is no one-click run solution like I expect you have with some IDEs like Visual Studio or CodeBlocks.
All you need to do is open your Android Studio and then import a project.
EDIT: I've already run Android project in Android Studio using Terminal (using Ubuntu 14.04LTS). This is my full command:
./android/android-studio/bin/studio.sh workspace/Android/glucosio-android/
Hope you find it useful
You can create command line launcher Tools > Creat Command-line Launcher
If you are using macOS then create an Automator Quick action.
Configure like following
Add a run shell script, then paste /usr/local/bin/studio $#. Make sure pass input is changed to as Arguments.
Save it (say Open with Android studio), then right click on the studio project folder > Quick actions > Open with Android studio. Or if you don't have much quick action this will list in the bottom of the context menu itself.
No, You need import the project from the Android studio.
There isn't a way to open directly from finder. What you need to do is:
On Android Studio go to File Menu -> New... -> Import Project
In Finder, select the ListView_Ex2.iml file.
Right click, and select Get Info
Under Open with: select Other and choose Android Studio, then Always Open With, and click Add.
Click Change All...
You can now double-click any IML file to open that project.

Categories

Resources