Android Studio says I'm not on gradle build, but I am - android

So I've just imported an app into Android Studio. It says
"Migrate Project to Gradle? This project does not use the Gradle build
system. We recommend that you migrate to using the Gradle build system."
However... it appears I am on the gradle system. I see
build.gradle
files at the app-level etc, so? This is causing issues when I try to run the module (getting AndroidManifest.xml does not exist error, which I apparently need to solve by synching the gradles... except that button doesn't exist because Android Studio thinks I'm not using the gradle system.)
Help?

Try to re-import your project in Android Studio:
Close your project
Back up your project
Delete the .idea folder in the root directory of the project
Delete all the .iml files in your project
Import your project in Android Studio, and in the dialog that
prompts you for a file, choose the build.gradle file.

Related

Android studio create multiple .iml for app module

I have created a new Android Kotlin project using Android Studio. Everything work as expected initially. However, when I close Android Studio and reopen it again a new .iml file is created inside the app module
Issue
Create a project in Android studio
Sync and build the project
Close Android Studio
Reopen Android Studio
New *.iml file is created for the app module
Workaround
Delete the .idea folder
Delete all *.iml files
Re-import project in Android studio
I have to do this workaround steps each time android studio launches. Is there any permanent solution for this. My Android studio version is 3.6.2
Screenshots
Project
app module
Thanks
This project contains multiple modules, one for the root of the project where you have build.gradle in the root and another for the app with the second build file. Modules can be also created for multiple Gradle source roots. This behavior is by design and is not an issue that needs to be fixed.
See the document about sharing the project files which mentions that you can ignore .iml files for Gradle projects as they are generated on importing.

"Gradle location is incorrect" when migrating android project from eclipse to android studio

I followed the this guide to migrate my android project
https://developer.android.com/sdk/installing/migrate.html
I have exported a Gradle file through eclipse. When I try to import the project to android studio, I am stucked with this error. Please help
Android studio version 0.6.1
That's not asking for your project's Gradle structured files it wants the location of your Gradle Build tools or Gradle configuration file.
It defaults as a file called .gradle in your user home directory I think.
Mine points to:
/home/indiv/.gradle
Although, I found it easier to import my Eclipse projects into Studio (as Eclipse projects) than export a Gradle project from Eclipse and then import to Studio.
Your choice though.

Convert a project to Android Studio

I'm trying to open the following project https://github.com/mik3y/usb-serial-for-android on Android Studio but all the things I try it give me errors related to gradle :s
It says version 0.9.0 introduce some incompatible changes but then I can't make the changes they said.
Can anyone try it to me?
The biggest issue is that Android Studio uses Gradle and Eclipse does not. It sounds like the GitHub project was built with Eclipse, which means you first have to import that project into Eclipse, then export it with the Gradle files.
From the Android docs
Export from Eclipse
Update your Eclipse ADT Plugin (you must have version 22.0 or higher).
In Eclipse, select File > Export.
In the window that appears, open Android and select Generate Gradle build files.
Select the project you want to export for Android Studio and click Finish.
Your selected project remains in the same location but now contains a build.gradle file and is ready for Android Studio.
Import into Android Studio In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
Click Import Project. Locate the project you exported from Eclipse,
expand it, select the build.gradle file and click OK. In the following
dialog, leave Use gradle wrapper selected and click OK. (You do not
need to specify the Gradle home.) Now that your project is imported to
Android Studio, read Tips and Tricks for some help getting started.
Note: It's possible to import an existing Android project to Android
Studio even if you don't generate a Gradle build file from
Eclipse—Android Studio will successfully build and run projects using
an existing Ant build file. However, in order to take advantage of
build variants and other advanced features in the future, we strongly
suggest that you generate a Gradle build file using the ADT plugin or
write your own Gradle build file for use with Android Studio. For more
information about the Gradle build system, see the Gradle Plugin User
Guide.

Not Use Gradle In Android Studio

I upgraded to the latest release of Android Studio and it no longer recognizes .iml files as projects. Previously, importing an Android project from just sources would create just an .iml file but now it creates a whole bunch of Gradle files which is really annoying.
Is there a way to get Android studio to not use Gradle and just .iml projects?
Android Studio is based on Intellij Idea in which .iml files are "IntelliJ IDEA Module" file which contains all information about module's its dependencies in the projects, each module will have its own .iml file which is a part of project structure in Intellij. Where build.gradle files are for building your application using gradle build system.
In AS 0.4.3 a lot of improvements are done for importing and converting eclipse project automatically in Gradle which doesn't allow to import eclipse project as it is.
I found a workaround to do this please follow the steps
Create a new folder/directory
Move your Eclipse project inside it
Now from import option in AS select the newly created directory instead of direct eclipse project directory.
Studio will give you a suggestion to move the project in Gradle as soon as it is done with import, don't do that.
But I strongly recommend you to start using gradle build system.
Have a look in to the Scott's explanation here :
Android Studio 0.4.3 Eclipse project without gradle

Syncing Android Studio project with Gradle files

I was working on a project, and then I got a prompt to update Android Studio. After I did that, I started getting this error when trying to run my app
It says
The project may need to be synced with Gradle files
How do I solve this?
EDIT
Starting with Android Studio 3.1, you should go to:
File -> Sync Project with Gradle Files
OLD
Clicking the button 'Sync Project With Gradle Files' should do the trick:
Tools -> Android -> Sync Project with Gradle Files
If that fails, try running 'Rebuild project':
Build -> Rebuild Project
Old Answer
When trying to run the application, instead of selecting the directory highlighted here in blue
I selected the subdirectory instead
and clicked "run".All the issues with Gradle are automatically resolved and the missing apk directory is automatically created.
New Solution
The Sync project with gradle files button disappeared from Android Studio for a while.Its back and you can find it here:
hit the button and wait for the task to complete
I've had this problem after installing the genymotion (another android amulator) plugin.
A closer inspection reveled that gradle needs SDK tools version 19.1.0 in order to run (I had 19.0.3 previously).
To fix it, I had to edit build.gradle and under android I changed to: buildToolsVersion 19.1.0
Then I had to rebuild again, and the error was gone.
Keys combination:
Ctrl + F5
Syncs the project with Gradle files.
The gradle versions in android studio and your code is not the same. This is why even after you update the gradle version on android studio, the error still persist.
So, edit the Gradle distribution reference in the gradle/wrapper/gradle-wrapper.properties file:
distributionUrl = https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Ref: https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle
I am using Android Studio 4 developing a Fluter/Dart application. There does not seem to be a Sync project with gradle button or file menu item, there is no clean or rebuild either.
I fixed the problem by removing the .idea folder. The suggestion included removing .gradle as well, but it did not exist.
i had this problem yesterday. can you folow the local path in windows explorer?
(C:\users\..\AndroidStudioProjects\SharedPreferencesDemoProject\SharedPreferencesDemo\build\apk\)
i had to manually create the 'apk' directory in '\build', then the problem was fixed

Categories

Resources