Add MacOS Support to Existing Android Studio Project - android-studio

How do you add a MacOS version of a Flutter/Dart project in Android Studio? I can create a new project and move everything over but I wonder if there is a more elegant way to add the MacOS (and later Windows and Linux as they come available) to the existing project.

This is pretty ugly, but it worked for me.
Rename the directory for the existing project (the one containing Pubspec.yaml) to old.my_app
Create a new project, in the same place with the same parameters (i.e., my_app)
Move/rename the macos directory in the newly created project (i.e., my_app) to the old.my_app directory
Delete the my_app directory (not the old.my_app directory!)
Move/rename the old.my_app directory to my_app
Obviously, the new macos app will not have any of the code that runs in the AppDelegate.swift file (if any) but the Dart side will run and the app will build.

Related

How do I install Android Studio 3.5 Canary 12?

I need to install it, and downloaded the file, but it is in ZIP format. Inside the archive there is no install file, only `uninstall. How do I install it?
You don't install the canary builds. They are meant to work alongside the stable versions which are installed.
For Windows, extract to some place like C:\Programs\AndroidStudioCanary and inside the bin there will be an executable file for 64bit version(and also for 32bit). Create a shortcut to the file and you are done.
For Linux, extract to some place like /home/user/AndroidStudioCanary and inside the bin there will be a bash script file studio.sh. After first launch close all projects via File->Close projects but do not close the IDE. Now in the main UI, click the settings cog and add desktop entry to create application shortcut.
Launch the shortcut from applications now.
EDIT:
Canary and stable versions can run along side each other and their settings can be changed independently. For Windows and linux the folder named .AndroidStudio3.6 will contain config for stable version and .AndroidStudioCanary4.0 or similarly named folder will contain config for the canary version. These folders are inside user directory and are hidden. I don't have a mac but assume something similar.
For canary builds, there are no traditional executable files that you use to "install" the IDE.
You can go into the bin folder, then run the studio.exe or studio64.exe file (depending on your platform) to run Android Studio

Android studio fails to find cmake

Due to disk space limits I moved my android SDK to a new drive/location.
I can no longer clean the project as android studio fails to locate cmake because it's looking in the old directory.
I updated the sdk path and most things work, I can even build the project and external ndk files.
But build->clean Project in android studio 3.3.2 can't find cmake when trying to clean because it's looking in the old sdk directory for cmake.
I've completely reinstalled the sdk and android studio from scratch, but it still looks in the old directory on the wrong drive when trying to execute:
task ':app:externalNativeBuildCleanDebug'
Where is this compiler location setting or script or path? and how do I change it to look in the right directory?
I used a grep tool to look for the old directory. They were mostly contained in the .externalNativeBuild directory -- I tried deleting the directory and letting android studio rebuild it, and that managed to clear whatever temp files were holding onto the old sdk directory. It seems to work now.

Why is Android studio not automatically cleaning my project

I recently renamed my project by closing Android Studio, renaming the root project directory then opening A.S again.
A.S names the project using the new directory name, then I open it. A new .iml file is created with the new name. I deleted the old one and cleaned the project.
Everything went fine but now when I build it just deploys the app instead of cleaning it first. I have to manually clean it and it's annoying.
Is there a setting that might have gotten messed up?
Platform Details: Android Studio 3.0.1, Windows 10
Ok. So, apparently if you add flavors to your project then you have to manually clean the project otherwise when you build, Android Studio will launch the previous APK.

How to restore build.gradle and .Gradle folder

When I was trying to solve an issue with Android Studio I accidentally deleted .Gradle folder at the top of the project and build.gradle from within the app. I will post a screen shot of my project in Android Studio. The build tab also produces "make module my app project name" and "deploy module to app engine". The usual clean project, rebuild.... are not there.
How can I restore them?
If your are not using a VCS:
try use the local history to recovery the build.gradle file in your root folder (right click on the root folder)
If it fails. you can create a new project and copy the build.gradle. Usually this file contains generic info (like android gradle pluging and the repos to be used in the modules)
the .gradle folder is not a problem. Gradle wrapper will recreate this file
I copied both from a different project and pasted them in my project. That didn't solve the problem and I imported the project File->new->import project but that only created a duplicate within my project. I closed the project and deleted it from the list of project in Android studio. Then I created a project by importing it from Android Studio Projects folder. It took forever stuck in the gradle build and I have to restart AS manually. Now I have all my files and the project is compiling as it should.
You just need to reimport your project it will by default create the new gradle folder

Android Studio breaks a part package into seperate directories

I recently imported a project I have been working on from eclipse to android studio and have been using robolectric to test units of my code. The unit tests are placed in a file system similar to this: src/test/java/com.foo.bar where com.foo.bar is a package. On every reboot of Android Studio the file system breaks a part the directory into src/test/java/com/foo/bar where all of the folders are directories (including the java folder which should be a Java folder).
Has anyone else experienced this problem?

Resources