I have the library and 2 samples for it. Say my-sdk, sample1, sample2. The file structure is:
Project folder, inside it settings.gradle, my-sdk and samples folder. Inside samples I have sample1 and sample2 folders.
My settings.gradle:
include ':my-sdk', 'samples:sample1', 'samples:sample2'
The problem is:
In Android Project View I see 4 projects:
sample1
sample2
my-sdk
samples (empty)
How to remove samples folder from Android Project View?
BTW. I have file samples.iml inside samples folder. So looks like for me that Android Studio thinks thats samples is a module but it just a folder for other modules.
UPD If I try to remove this empty module from Module Settings F4 than IDE crashes.
Do these steps:
remove from the sample folder the .iml file
remove from the sample folder the build.gradle (if it exists)
run a ./gradlew clean and resync gradle project.
If it is not enough remove:
.idea : in this folder Android Studio saves the settings
.iml in each module. In these files Android Studio stores the module information
Delete these resources, and then reimport again the folder.
Related
I have repository in Git that has this structure:
-web-app
-mobile-app
When I checkout the project in Android Studio my project has structure like this:
android-studio-project
-web-app
-mobile-app
The mobile-app folder is folder that contains the module of my android application end when I commit some changes some files and folders like gradle/wrapper, build.gradle, gradle.properties, settings.gradle are outside the folder mobile-app and my Git structure goes like this:
android-studio-project
-web-app
-mobile-app
-gradle/wrapper
-build.gradle
-gradle.properties
-settings.gradle
-...
I want to put all files and mobile-app folder in sub-folder in order to achieve first Git structure.
I tried to create a folder in Android Studio and move all needed files there but the project totally messed up.
I moved the gradle's files in to mobile-app folder but could not build the project at all.
Any ideas how can achieve the desired Git structure?
I'm trying to move my IntelliJ IDEA (2017.3) Android project to another computer just copying the files and it does not work. I am aware of this and this, but in the case of Android project it does not work. All the xml files inside .idea store paths relative to the home ($USER_HOME$) instead of project home ($PROJECT_DIR$). Oddly, Maven projects seem to generate paths relative to the project home and those ones can be copied. But not with gradle projects.
Anyone knows how to solve this ?
EDIT: Bear in mind that I want to copy ALL project settings included running configurations. I want that someone opens the project and find exactly what I have. I know I can reimport the project, but then I'll loose some configuration.
Here's the files and folders that need to be excluded from the copy (assuming that your project has a module called app), preferably if you copy the entire project folder to some where else on the same computer and then deleting the unneeded one by one:
folders .idea, .gradle or any folder who's name starts with a .. They are usually found within the root folder of the project and within the module root folder.
build folder found in the project root folder and in module root folder.
any file who's extension is .iml, found in the project root folder and in module root folder.
local.properties found in project root folder.
The rest of the files and folders need to be kept. With the above excluded, the project can be re-imported in Android Studio properly with the correct configurations relative to your second PC.
On a side note, these are the typical exclusions added in .gitignore of an Android Project Git Repo.
Ok, I found the problem. It is related to how gradle resolve symlinks. This is the issue. Summarizing, if you open your project with a path that contains a symlink, absolute paths will be created in the configuration files and your project won't be portable.
I have reopened the project again using an absolute path and then all the configuration files use PROJECT_DIR instead of USER_HOME
I was following a youtube tutorial on changing my android studio project name, so that when I download it from Google Play it doesn't display the old app name. The video suggested Refactor--> Renaming the .IML file, and then going to Modules.xml and changing the values there. Now my project won't build and all my classes have a red "J" on them and they're all grayed out. Please help!!!
You should have a structure like this:
root
.idea //remove it
mymodule
mymodule.iml //remove it
build.gradle
src
project.iml //remove it
build.gradle
settings.gradle
Follow these steps:
Remove the iml file in each module
Remove the .idea folder
Open the settings.gradle file and check if it is somenthing like:
include ':mymodule'
where mymodule is the name of the folder which contains the module (build.gradle and code)
resync and rebuild the project
I am following some posts/questions about AndroidStudio-1.2 and it seems that there is a different project structure: app/src/main; while my old 1.0 project looked like: src/main (no app).
Not sure if this is causing this, but I am not able to get gradle to identify any test files, while running tests.
You probably have to rename src/test to src/androidTest.
The app directory is a subproject directory. By default AndroidStudio generate a structure ready for multi-module project. i.e. :
a root directory with the root build.gradle + gradle.settings (listing all modules in your project)
a subdirectory (named "app") where you can put all the sources for your application.
Later it is more easy to add a library module (just create a directory myLib in the root folder).
This structure is just proposed by AndroidStudio: you can also use AndroidStudio with only one level of directory and one single build.gradle.
I found a library on git. https://github.com/flavienlaurent/NotBoringActionBar
after imported to the eclipse, I noticed that the src folder is empty and there is a folder called java. Tried to run it anyway but it gave me an error.
Do I have to make some changes before running it?
The project you are trying to import is developed with Android studio, so there is some extra files in it.
To import it in your eclipse you need to import it as normal android project. now your src folder is empty and you have an extra folder named java
copy com package from java folder and paste it in src folder
Delete java and bin folder
Clean and build your project
Run on emulator or device
The Project you are trying to import is a project based on Gradle build system developed using Android Studio.
In such project everything related to code is in App/src/main
/java contains all .java files
/res same as res in eclipse
AndroidManifest.xml
So easiest solution is create a new project in eclipse and copy paste the file accordingly,
In you case
Copy the src/com directory in /src in eclipse
Copy the /res in to /res directory of created project
Replace AndroidManifest.xml
But it is strongly recommended to migrate from Eclipse to Android Studio instead of doing all these because now all the libraries available are migrating in to gradle.