As said by the title, I cannot find any .gradle file and i dont understand why.
My project works and compiles fine, I dont have any problem inside the IDE but I would like to add SherlockActionBars, and to do that I have to modify settings.gradle and build.gradle, but I just can't find those two files anywere.
NB: The project was imported from eclipse
Thanks in advance
You can just create these files, if it is compiling and working fine in Android Studio 0.2.2 then likely they can just be manually created.
One thing, you said you imported from Eclipse - but did you do the manual step of exporting while in Eclipse? Also - I suggest the eclipse be the version that comes with the Gootle ADT download.
Steps on exporting: http://developer.android.com/sdk/installing/migrate.html
Related
.0. I imported a project to the PC (specifically here = generated Ktor project, although I've seen such behavior before with Compose Desktop projects)
Generated here
.1. IntelliJ Idea doesn't recognize it as a project
When I open the same project on Android Studio = it works fine
Here is how the project supposed to look in IntelliJ (this Ktor project I build manually with IDE and it worked):
.2. I was able to make the project folders visible to IDE:
Repair IDE->Rescan Project Indexes->Reopen Project
Now It look like this:
But IDE still doesn't see my modules properly
How do I properly configure the imported project?
Note: I've read IntelliJ does not show project folders
And tried methods described there. But a lot of answers are hard to replicate as IntelliJ interface changed.
Edit: I've fixed it with Manage Idea Settings->Restore Default Settings. Now projects are opened properly. Thank everyone for your time.
I've fixed the problem with Manage Idea Settings->Restore Default Settings. Now projects are opened properly. Thank everyone for your time.
I cloned my repo and now Android studio (1.3.1) is having hard time detecting my module 'app'
It is not showing any module in edit configuration(as in image below).
It's already defined in 'Settings.gradle'
include ':app'
I tried importing this app module but it says project already contains module with this name
Tried other solutions too. Stuck here.
Note: This repo doesn't have .iml file of project.
Had a similar issue with Android Studio 3.5.3.
Deleting .iml and local.properties files along with .idea and .gradle folders before reopening the project fixed my issue.
Different SDK installation worked for me.
How I came to know?:
(Meanwhile 2 days passed in this issue, I tried all possible solutions like adding facets, adding modules etc. (I came to know it is working in other collegue's machine ) But they didn't work, So last option for me was fresh installation of Android Studio. So I...)
1. Installed Android Studio 2.2.3 with different sdk location unknowingly(Let's say loc2).
2. It was working, later I made batch update to 2.3.2. After update, I chose project location as sdk location (Lets say loc1 ). This time it din't work and I got same error. This was a moment when switching to loc2 worked!!
I am teaching android app programming at a highschool. I found Eclipse to fragile so we are now trying out Android Studio. But a couple of students get that Android Studio with R. in red font, showing that it is not recognized.
This happened for example when the student copied the contents of my files.
It sometimes happens when you open a proyect from other sources. Just Synchronize it or press Ctrl-Alt-Y.
R.java file issues : 1) check the naming convention of images in drawable folder with size.
2) check the style of your application
In your case it may be missing style .. So upadate the style in value folder as per application .
The most common reason for this error is bad XML coding. For example using android:src="#drawable#drawable/picture" in ImageView will give you R error as it will not let R.Java file to build. Its hard to trace such errors as XML file will not show any error.
Also take a look if your resources are of good quality!
Hope it helps! Cheers
Build -> Clean Project
Tools -> Android -> Sync Project with Gradle Files
and all OK!
Try adding the following:
android.enableAapt2=false
to gradle.properties and Refresh:
You can also do the following: Clean Project and Sync Project with Gradle Files.
try importing your project :
To migrate existing Android projects, simply import them using Android Studio:
In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
Click Import Non-Android Studio 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.)
Android Studio properly updates the project structure and creates the appropriate Gradle build file.
First if the existing project was developed in eclipse you need to import the project and then check what are the error. If your students are coping codes from your project then after coping the codes they need to clean and sync the project. If still your problem not solved try this in android studio :-
File/invalidate caches/restart.
Hope it helps you :)
Especially, for regeneration of R.Java file.
If you have tried all these options:
Clean Project
Rebuild Project
Invalidate Caches / Restart
deleted .gradle folder
deleted .idea folder
deleted app/build/generated folder
checked your xml files
checked your drawables and strings
and still face problem then check your classpath dependency in your Project Gradle Scripts and if it's, this:
classpath 'com.android.tools.build:gradle:3.3.2'
then downgrade it to, this:
classpath 'com.android.tools.build:gradle:3.2.1'
clean and rebuild it will sync your project.
I had the same issue, and the lint gave me a hand...
If you're using lint, it can help too.
In gradle.build(Module:app) add the lintOptions sub-element in android element as shown below, then lint will fix it for you!!.
android {
lintOptions {
abortOnError false
}
}
I hope it helps!!
If you open an IntelliJ project in Android Studio, there is a warning that you should migrate to Gradle and it sends you to this link. This process seems a bit strange and complicating since the process is not well explained (it's more for experienced programmers who know how Gradle project looks like).
There is also a feature in Android Studio to import IntelliJ IDEA project. I did it with my project and it imported everything (except empty Proguard file), compiled well and all seems to work fine.
However, is this a valid process too - can I safely import future IDEA's project using import feature rather than the solution suggested by Android Studio?
Are there hidden dangers using this method? The least I would like it to continue coding newly imported Gradle-based project and at some point realize that the project is corrupted.
It should be fine. The projects it imports have their Gradle files properly set up, and if it works okay after import, there's nothing about the process by which it created that should make it stop working in the future. I think the link in that warning is just out of date.
I am starting my migration from Eclipse to Android Studio, and start playing with new projects on Studio.
My test project was working fine till I got some errors messages.
I had to do some manipulation (https://stackoverflow.com/a/16876993/327402) to enable the error output to display, and found the issue that I fixed.
Unfortunately, after this "workaround" (Why the hell have I to make such things to see my errors?), I found that there was an error message that I cannot fix:
error: duplicate class: com.mypackage.name.BuildConfig
error: duplicate class: com.mypackage.name.R
I also noticed that I am not the only one to have this issue (see the comment in the SO answer I linked above)
First time, I was able to fix it by enabling "External build" again, but that happened again, because I needed to see the error output and everything is now broken, and I cannot find what happen.
With Eclipse, the R file was easy to find, in the gen folder, but with Android Studio, there are too many files, and I am a little bit lost.
Any idea/suggestion?
I've found a question like this that has some replies here:
Cannot resolve R.java, duplicate class
You can try this:
Delete the Build folder generated by Android Studio automatically
Also you can try to Rebuild project by clicking Build->Rebuild project after deleting build folder.
So, just to let you know...
A few minutes after I posted my question, Google released an update to Android Studio (0.1.5)
See link: https://plus.google.com/+AndroidDevelopers/posts/Y9vhvGaHCbh
Tor Norbye kindly answered my question in this community, and I am sharing here
So the workaround I quoted in the OP is no more mandatory.
Enabling again External build after upgrading Android Sudio let me see the real errors ( a library and some Gradle import that I fixed)
So, I consider the Android Studio upgrade as the best answer to this question...
Ok, I also have the same problem, and this is what worked for me.
I first unticked external build from compiler settings. Then when I compiled i get two errors related to R.java, duplicate class.
Then i delete the build folder manually from finder. Then rebuild it from android studio, but still same error.
Then I again go back to compiler preference and tick the external build setting, and it worked fine after that.
Looks like some bug.
apparently, or at least for me 0.1.5 has a bug and cannot run in external build
because of some path error you can read about here
https://code.google.com/p/android/issues/detail?id=56628
so i switched to internal building, and then i hit the double R symbol bug
after deleting the build path application is compiled without errors but the build folder is not fully rebuilt, I'm missing the R.java file which the internal builder does not make.
i've rebuilt it on the external builder on an unupdated version as a temp workaround while this issues is fixed.
btw if anyone knows how to tell internal gradle to rebuild the build folder please share.
I just had the same problem and found a way to solve it (You can do this with Android Studio open):
Go to you Android Studio projects folder located in c:\users[USERNAME]\AndroidStudioProjects
Locate your project folder and open it.
Delete the folder named build.
From here, enter your application name folder, where you can find another build folder among with libs and src folders and a file named build.gradle.
RENAME the build folder to build2 or something else.
Now in Android Studio go to Build->Rebuild Project.
And after the project was rebuilt, open again the folder where the build2 folder that you renamed is located.
Delete the new folder named build that was created.
Rename your build2 folder to build again.
Done.