Why can't migrate my flutter project to androidx? - flutter

I have a flutter project I want to migrate to AndroidX. The docs say I should open Android Studio and click "Sync Project with Gradle Files" but that option is disabled for me as seen in the following picture:
how can I enable this option and migrate to AndroidX?

Open Android Studio.
Select Open an existing Android Studio Project.
Open the android directory within your app.
Wait until the project has been synced successfully. (This happens automatically once you open the project, but if it doesn’t, select Sync Project with Gradle Files from the File menu).
If you are asked to backup the project before proceeding, check Backup project as Zip file, then click Migrate. Lastly, save the zip file in your location of preference.
The refactoring preview shows the list of changes. Finally, click Do Refactor:
That is it! You successfully migrated your project to AndroidX.
Select Migrate to AndroidX from the Refactor menu.

Related

Move Root Folder of Flutter Project

When working on a Mac with Flutter in Android Studio (Arctic Fox 2021.3.1 Patch 4 and XCode 13.1 and/or 13.2):
If you move the root folder of your Flutter project using Finder, then open it in Android Studio and run it, the original folder location is still re-written (multiple sub folders with empty contents, usually, but not always).
Also, the moved project will no longer build from within XCode.
This means that if you don't know the final desired location for your project at the time you create it, you will not be able to move it without weird stuff happening.
How can you move a Flutter project that was created with Android Studio without it having weird side-effects?
More info on how to reproduce:
Close all IDEs
Open Android Studio
Using Android Studio, create a new default FLUTTER project using Java as the Android code choice
Using Android Studio, run this project on an Android Emulator
Using Android Studio, run this project on an IOS simulator
Using Android Studio, open the project in XCode (right-click ios folder and select Flutter\Open project in Xcode)
Using XCode, run the project on an IOS simulator
[everything should have worked so far]
Close all IDEs
Using Finder, move the project folder to a new location that is at the same depth as its current folder, but with a different parent folder. Meaning if current location is: [root]/x/y/a/my_project_original, the destination would be: [root]/x/y/b/my_project_copy
delete the original folder and remember where it was
Using Android Studio, open the project from its new location
Using Android Studio, open the project in XCode (right-click ios folder and select Flutter\Open project in Xcode)
Attempt to run on IOS simulator
[observe error - "Command PhaseScriptExecution failed with a nonzero exit code" // "file not found exception"]
Using Finder, check to verify original folder location has NOT been re-written
Using Android Studio, run the project on Android emulator
[observe that original folder has been re-written!]
Here are the steps I follow to move a project's location on my mac :
Close your project on Android Studio (File > Close Project)
Close Android Studio
Move your project to your new location
Open Android Studio
Delete your project from the Recent Projects (on the list of Recent Projects, click on the Settings icon on the right, and "Remove from recent projects")
Click on "Open" and select your project in the new location.
Delete the .idea file and build/ folder
The steps should be the same within XCode (in the main window, remove the old location from your recent projects, and Open the new location)
You can move your Flutter project anywhere, as long as you don't move the files inside the project relative to each other.
A note about pod install: If you are immediately running from Xcode, you need to run pod install inside the ios folder after adding a plugin to your pubspec.yaml. If you run flutter run or use Android Studio to run it, that will run pod install for you automatically. However, you don't have to run pod install after moving the project, I've just tested it.
If you move the root folder of your project using Finder, then open it
in Android Studio and run it, the original folder location is still
re-written (multiple sub folders with empty contents, usually, but not
always).
This only happens if you kept Android Studio open when moving the files. You shouldn't open the old project reference in Android Studio, you should open the project using File > Open....
Also, the moved project will no longer build from within Xcode.
If you provide the errors, that will help us help you.
How can you move a Flutter project that was created with Android Studio without it having weird side-effects?
I have not found any side effects of moving a Flutter project. Quit Android Studio if it is running, and open it using File > Open.... Or if you are in terminal, run (if installed using Jetbrains toolbox) open -a ~/Applications/JetBrains\ Toolbox/Android\ Studio.app/

How to migrate to AndroidX in Android-Studio latest version?

When i click on migrate to androidX, it ask for backup as a zip file. While i click on (ok), after that nothing happens. I can't find from where i can refactor it.
In the android folder in your flutter app, there is gradle.properties file, include this
android.useAndroidX=true
then you're good to go

Android Studio files location?

So i'm making the switch from eclipse to Android studio, but something that irks me is I can't seem to find where my files are located? In eclipse, right before it boots up, it allows you to pick where they will be, which made it easy for managing and tracking them. Is there a way to do this in android studio?
Yes! If you start a new project it will show project location, you can choose any location you want to save your project.
You can Copy/Paste your Eclipse Project in any folder and reopen it with Import Project (Eclipse ADT,Gradle,etc.).

Migrate from Eclipse to Android studio: only empty build.gradle exported

The project works well in Eclipse and I have upgraded the android SDK to 22.0.1 too. when I follow the instruction
1, In Eclipse, select File > Export.
2, In the window that appears, open Android and select Generate Gradle build files.
3, Select the project you want to export for Android Studio and click Finish.
But the problem is the exported build.gradle is empty.only one comments there:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
and this empty file is never able to guide the android studio to import the project successfully.
Does anyone has idea what I should do? Thanks.

Subversion with Eclipse for android

Okay I am starting to give up with this. I have been trying to setup sebversion in Eclipse for my android project. I have been following the following tutorial
http://blog.bauson.com/eclipse-subclipse-svn-hostgator-com.html
I got the following:
Created a repository called myRep
Created a project under with source files myRep/TestProject and attached it to trunk
installed subclipse and got it to grab the repository
Now when, it says "Checkout as a project configured using the new project wizard", I get to choose the type of project. If I choose android application project then it creates a default android project and nothing is checked out. But when I choose General Project, it does grab the whole thing in the following structure
Repositony->TestProject->Trunk->All my android files and folders
However I want it to be android project so I can compile and run it. I did a lot of googling and I need your help pleeease!
Never mind, I figured it out. Apperently, when you choose the repository you have to right click and click refresh and it will show you a list of Folders (stupid eclipse does not do it automatically). Then you choose your project and create it as a new project. Voilla, you get it compiling and running